Problem with 'save_post' hook not running
-
I have a custom post type, with a custom meta box which contains a number of input fields.
The meta box is displaying fine but when completing all the fields the data is not saving, in fact, the function I call with the
save_post
hook does not appear to be running at all…I use the
register_meta_box_cb
to define my function which adds the meta box for me. I then use the following in my attempt to save the custom data…add_action( 'save_post', 'my_save_function', 10, 2 ); function my_save_function( $post_id, $post ) { foreach( $_POST as $meta_key => $new_meta_value ) { if( substr( $meta_key, 0, 6 ) == 'venue_' ) { // This is verified and correct update_post_meta( $post_id, $meta_key, $new_meta_value ); } } }
Been staring at this and searching the codex and Google for a couple of hours now with no progress… Whatever I put in that save function just does not execute. I have tried die() and error_log at the very top of the function to ensure my checks are not the problem… but nothing. (the function above is a cut down version to what I really have)
- The topic ‘Problem with 'save_post' hook not running’ is closed to new replies.