Which action hook can I use when a featured image has been selected

The set_post_thumbnail function uses the metadata functions to set the featured image. You have two actions to hook into that process: EDIT: The action hooks are now defined different Thanks @dalbaeb! update_postmeta, before the data is written into the database. Previously update_post_meta updated_postmeta, after the data is written into the database. Previously updated_post_meta SECOND EDIT: … Read more

What are the limitations of wp_update_post()?

You are correct; WordPress will not update custom database columns using wp_update_post() or wp_insert_post(). Instead of creating custom database columns, consider using post meta and/or taxonomy APIs. If you must altar the wp_posts table, you will need to update your custom columns on your own and you may run into issues with various other plugins … Read more

Automatically fill custom field value on post publish/update

See add_meta_box which has a lot of demo code for working with meta fields. Here is the most relevant part for you: /* Do something with the data entered */ add_action( ‘save_post’, ‘myplugin_save_postdata’ ); /* When the post is saved, saves our custom data */ function myplugin_save_postdata( $post_id ) { // First we need to … Read more

Post/Page Publish/Update button not clickable once I make an edit

It appears to be a bug, but one that can be hacked around each time it happens with about 2 seconds of work. This wordpress forum thread: If you’re using Chrome, right-click on the greyed-out “Update” button and select “Inspect Element”. You will see something to the likes of: <input name=”save” type=”submit” class=”button button-primary button-large … Read more

Why doesn’t wp_update_post() update the post_status field?

Answer couldn’t be simpler. As pointed out by Otto at the wp-hackers list, problem was me not setting post_date_gmt when using wp_update_post(). Final code looks like this: if ( $post_date < strtotime( “tomorrow” ) ) { $status=”publish”; $newpostdata[‘post_status’] = $status; $newpostdata[‘post_date’] = date( ‘Y-m-d H:i:s’, $post_date ); // Also pass ‘post_date_gmt’ so that WP plays … Read more