Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I developed a plugin having a custom metabox that is using the save_post hook to store data. The plugin is 18 months old and is used by thousands of customers, so I'm pretty sure everything is good.

Since I updated my testing platform to v3.6.1, I can't get that hook to run on previously created pages/posts. It only works on new ones.

(I am the only WP user in the website. WP DEBUG is enabled)

Has anyone experienced the same? Any clue? I missed some changes?

EDIT:

The code I'm using now to check the hook is this (I've deleted the inner code for privacy reasons):

function saving_metabox($post_id) {
    die('test');

    if(isset($_POST['plugin_noncename'])) {
               ... ...
    }

    return $post_id;
}
add_action('save_post', 'saving_metabox');
share|improve this question
4  
Please add the save_post hook code that you're using (ie, the function you're trying to run) to your question. –  Pat J Sep 18 '13 at 19:55
    
Sure, I've edited the main post! –  a-coder Sep 19 '13 at 8:38
    
Being an action, there's no need of return, only if you want to break further execution. Does that die() has any effect? If you disable all other plugins, does the issue persist? –  brasofilo Sep 21 '13 at 1:27
    
All the plugins in my testing website have been made by me (except WPML) so I'm quite sure there is nothing wrong. Anyway I tried deactivating everything and removing the "return" but nothing changes. This is becoming really really stange.. –  a-coder Sep 23 '13 at 9:55
    
I can assure that on WP 3.6.1 save_post hook is still triggered. So if you have disabled any other plugin and tested on twentythirteen theme, the wrong code is in your plugin. Try to enable logging (not only debug) and read the log, maybe you'll find some info there. –  G. M. Oct 11 '13 at 1:18

1 Answer 1

Try changing your content and saving again. This will trigger the action. save_post is only called if the content has changed.

To come in before this is checked, you can use the pre_post_update hook.

add_action( 'pre_post_update', 'saving_metabox' );
function saving_metabox( $post_id ) {
    die('test');
}
share|improve this answer
    
Nope, doesn't work. –  a-coder Oct 11 '13 at 11:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.