Can not get future_to_publish to work
Can not get future_to_publish to work
Can not get future_to_publish to work
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
Remove ‘private’ and ‘pending review’ options from post status dropdown
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.
The best way to do that is with this plugin: https://wordpress.org/plugins/public-post-preview/ OF course you can dig into it’s source code to try to implement the core functionality if you prefer, but I use that plugin on several active sites with success.
I’m not sure if this is going to help or not, but it might help to know that some actions fire more than once. For example, save_post will actually fire three or four times on a given save. One is for the revision. One of the new post. Etc. It could be, in your case, … Read more
You are stepping on a query mine. It is easy to assume that: You can change query. Parameters are well defined. So by changing of parameters you can achieve desired results. In reality there are plenty of query parameters, touching which leads into horrible dead ends. WordPress is engineered to query and show posts which … Read more
I had the same issue and found a solution. From what I learned so far, there might be two causes to this problem: WP doesn’t recognize your rewrite rules because they are not cached yet. You can check this by dumping get_option( ‘rewrite_rules’ ); and if your rules did get cached, then they’ll be in … Read more
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
As probably there is not so many unpublished posts with images, You could exclude them from Your WP_Query, adding: ‘post_parent’ => ‘-12,-34,-56′ this would add overhead of only one query grabbing id’s of these posts