Auto draft posts when scheduled date is reached
Auto draft posts when scheduled date is reached
Auto draft posts when scheduled date is reached
Hope this can help: function wpse_display_post_counts_by_categories() { $categories = get_categories(); $container = []; foreach ($categories as $category) { $args = [ ‘post_type’ => ‘post’, // Change to your post type. ‘post_status’ => ‘publish’, ‘category’ => $category->term_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1 ]; $posts = get_posts($args); if ( count($posts) ) { // … Read more
Okay, I think to start you need to change line 470 of the file includes/admin/class-learndash-admin-binary-selector.php from: ‘post_status’ => array(‘publish’), to ‘post_status’ => array(‘any’), If this doesn’t work on its own, there may be other places you need to change this as well – do a global file search on ‘post_status’ and look for places where … Read more
I figured out how to change the post status and information through code. <?php $my_post = array(‘ID’ => 77, ‘post_title’ => ‘on’,’post_content’ => ‘on’,’post_status’ => ‘draft’,); wp_update_post( $my_post );?> Now I just need to figure out how to make it run when a button is clicked.
Replace this line: if ($old_status != ‘draft’ || $new_status != ‘publish’) { with: if ( $post->post_type != ‘post’ || $new_status != ‘publish’ || $old_status != ‘auto-draft’ ) { You want to run your code on post transition from auto-draft to publish, which will occur once only, when your post is created. UPDATE The problem is … Read more
I took your code an minimized it, and made a .csv with 3 rows, and was able to get the same error as you. However, I got three instances of the same post. No coincidence that I have 3 rows in my csv. Your insert code is right, so it has to be the hook … Read more
How to stop post status from reverting to Published?
How to save post_status using action save_post?
Looks like I was overcomplicating things. This is the solution: add_filter( ‘woocommerce_email_classes’, ‘custom_woocommerce_email_classes’, 10, 1 ); function custom_woocommerce_email_classes( $email_classes ) { $email_classes[ ‘WC_Email_Customer_On_Review_Request’ ] = include_once ‘includes/classes/class-wc-email-customer-on-review-request.php’; // Register custom trigger to send on-hold email when status is switched from on-review to on-hold. add_action( ‘woocommerce_order_status_on-review_to_on-hold_notification’, [ $email_classes[ ‘WC_Email_Customer_On_Hold_Order’ ], ‘trigger’ ], 10, 2 ); return … Read more
Custom status and permalinks don’t work?