Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"save_post" hook not working on post type attachment

Tags:

php

wordpress

I am making use of the "SEO Ultimate" plugin for the seo purpose. The meta box is working fine for the post_type = post. But as I am saving the meta details for the post_type = attachment then it's not working. It just leaves the field blank after saving the details.

After research on the plugin, I found a function name save_postmeta_box which is hooked with save_post. I thinks there is a problem with the hook which doesn't work on post_type = attachment.

like image 518
Ajay Choudhary Avatar asked Oct 04 '22 04:10

Ajay Choudhary


1 Answers

After a research on the hook's, I got the solution for this error, you just need to add a attachment hook. And the plugin will work fine for post_type=attachment.

Go to the line no. 227 "http://hostname.com/wp-content/plugin/seo-ultimate/plugin/class.seo-ultimate.php" and add this code below as given here:

add_action('edit_attachment', array ( &$this, 'save_postmeta_box'));

Now you can add the meta details on the meta boxes.

like image 91
Ajay Choudhary Avatar answered Oct 10 '22 10:10

Ajay Choudhary