WordPress action hooks related to scheduled posts not Fired
WordPress action hooks related to scheduled posts not Fired
WordPress action hooks related to scheduled posts not Fired
Allowing user to edit posts based on the post status
Individual post. Meta_key, taxonomy or post status for separation?
how to transition to custom post status on post save
Wrong post_status notice after wp_insert_post_data
There’s a more elegant way of updating your posts using the global $wpdb. function rsc_unpublish_all_ads( $post_id, $post, $update ) { // select all ads other than the current one $args = array( ‘nopaging’ => true, ‘post__not_in’ => array($post_id), ‘post_type’ => ‘rsc-ads’, ‘post_status’ => ‘publish’, ‘fields’=>’ids’ ); $query = new WP_Query($args); $published_ads = $query->posts;//array of post … Read more
From WP 3.7 you have the option to hook to the save_post hook directly for you post_type. For example: function update_post_parent_status_on_complete( $post_id ) { if(!isset($post)) $post = get_post($post_id); // checking the status you want and also that has a parent if ($post->post_status == ‘completed’ && $post->post_parent !=0 ){ $parent_id = $post->post_parent; update_post_meta($parent_id, ‘screening_status’, ‘screen’); } … Read more
Custom Status of Custom Post type need to EXCLUDE from Taxonomy pages
date(‘M’) => ‘Aug’ and date(‘m’) => 08 add_action(‘wp’, function(){ $current_month = date(‘M’); if( $current_month == ‘Aug’ ) { wp_update_post( array( ‘ID’ => “product_id”, ‘post_status’ => ‘publish’ )); } else { wp_update_post( array( ‘ID’ => “product_id”, ‘post_status’ => ‘draft’ )); } });
Here is how I realized a simple media workflow. Security checking and sanitizing is up to everyone. Based on WordPress version: 4.9.8 Create Attachment Post | Handle Media if (!empty($_FILES) && isset($_POST[‘postid’])) { media_handle_upload(“attachments”, $_POST[‘postid’]); } Post status pending is not possible for attachments when using media_handle_upload. For this case a filter needs to be … Read more