1 day after custom date change post status to draft

Your question isn’t very clear. Do you mean: 1 day after koncerter_start_date all posts with custom-post-type koncert have to get the status draft? EDIT Code: add_action( ‘wp_loaded’, ‘concert_daily_tasks’ ); function concert_daily_tasks() { $current_url = “https://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; if ( $current_url == ‘https://example.com/concert-daily-tasks’ ) { // <– set the correct URL! check_concert_status(); } } … Read more

Create front end link to save post (or unpublish post) as draft

You can use wp_update_post() to change the status of a post. global $current_user; get_currentuserinfo(); $post_id = $_GET[‘post_id’]; $the_post = get_post( $post_id ); if ( $the_post->post_author == $current_user->ID && $the_post ) { $the_post->post_status=”draft”; wp_update_post( $the_post ); } Use wp_insert_post() with post_status => ‘draft’ to save a post.

Include Drafts or Future posts with count_user_posts?

This will do what you want: $args = array( ‘author’ => $curauth->ID, ‘post_status’ => array( ‘publish’, ‘pending’, ‘draft’, ‘future’ ) ); $posts = new WP_Query(); $post_count = $posts->found_posts; It will include drafts, pending posts, published posts, and future posts. There are more you can set, such as trashed posts, and private posts, but that didn’t … Read more