Multiple Post Status

How can I assigned a post to multiple post status like it will be in ‘publish’ status and also a custom post status say ‘hide’ post status. This can be achieved by storing a post meta value. You can do stuff on the post based on this meta value. by this publish post count will … Read more

wordpress post status inquery

That is called as Revision in WordPress. Whenever you update your post, the older content of that post is treated as Revision and a new record for revision is inserted in posts table. And we can check our revisions from Revision meta box. More detail : https://codex.wordpress.org/Revisions For – How to solve it to make … Read more

Custom post status filter links always show a count of all posts in the site with that status, not the logged in users count

Edit: Just to credit the original, I’m fairly sure [this] is where I grabbed it from. Seems a quick search shows stackexchange is full of modifications of the same/ish code. But as the comments are spot on, I’d say all the credit goes to @W van Dam I had a similar setup with multiple users … Read more

Workflow for attachments in WordPress

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

Force Custom Post Type Status to ‘Future’ on first Save or Publish

wp_insert_post_data filters post data just before it is inserted into the database. Documentation add_filter(‘wp_insert_post_data’, ‘schedule_post_on_publish’, ’99’); function schedule_post_on_publish($data) { $post_type = “event”; // Replace event with exact slug of your custom post type if ( $data[‘post_type’] == $post_type AND $data[‘post_status’] == ‘publish’ ) { $data[‘post_status’] = ‘future’; } return $data; } This may help.

Schedule future post to custom post status instead of publish?

Here is one idea: You could try to use the future_to_publish action to change the post status: add_action(‘future_to_publish’, ‘set_status_online_wpse_95701’); function set_status_online_wpse_95701( $post ) { if ( $post && $post->post_type===”stream”){ $post->post_status=”online”; // change the post_status wp_update_post( $post ); } }

Function to change post status IF current user and post author are the same

I was unable to find any action called wp_update_post. Are you sure it’s a valid one? Lets try the hook publish_post. add_action(‘publish_post’, ‘check_user_publish’, 10, 2); function check_user_publish ($post_id, $post) { $user_id = get_current_user_id(); if ($user_id != $post->post_author) return; $query = array( ‘ID’ => $post_id, ‘post_status’ => ‘draft’, ); wp_update_post( $query, true ); }} code not … Read more