Return $post_id when DOING_AUTOSAVE?

I see the following pattern over and over, on this site and on other places: add_action( ‘save_post’, ‘wpse14169_save_post’ ); function wpse14169_save_post( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) { return $post_id; } // Other code… } Why should I return $post_id? save_post is an action, and the return value of an … Read more

Set custom messages for post update/save

I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it! 3 s 3 http://codex.wordpress.org/Function_Reference/register_post_type example: //add filter to ensure the text Book, or book, is displayed when user updates a book add_filter(‘post_updated_messages’, ‘codex_book_updated_messages’); function codex_book_updated_messages( $messages ) { global $post, … Read more

Metabox with checkbox is not updating

I trying to set a meta_box with a single checkbox, everything goes fine, however if I uncheck it and save the post, it marks again as checked, I’ve been taking a look but I cannot find my mistake. Take a look a my code. function am_checkbox_option() { global $post; $custom = get_post_custom($post->ID); $front_event = $custom[“front_event”][0]; … Read more

Prevent post from being published if custom fields not filled

I have a custom post type Event that contains a starting and ending date/times custom fields (as metaboxes in the post edit screen). I would like to make sure that an Event cannot get published (or scheduled) without the dates being filled, as that will cause problems with the templates displaying the Event data (besides … Read more