Questions tagged [post-status]

WordPress allows you to set a workflow status of the content.

Filter by
Sorted by
Tagged with
1 vote
0 answers
12 views

When using get_terms with hide_empty = true, terms that only contain scheduled posts are not returned. How to override this?

My code is simply: $cats = get_terms( [ 'taxonomy' => 'category', ], ); Obviously, hide_empty is true by default. There's a category that only contains scheduled posts and it's not ...
William Beaumont's user avatar
1 vote
1 answer
26 views

Can't publish custom type posts that don't support title and editor, instead they're saved as draft

I’m developing a plugin that registers custom post types without support for title and editor. I’ve been working on this project for a couple of months now and when I began (WP version 6.3.1), it used ...
user5728578's user avatar
1 vote
1 answer
27 views

REST API - Retrieving posts with custom status

I am still in the process of learning how to use the WordPress REST API and am attempting to retrieve all posts which have been assigned the custom status "archived". I have already created ...
Samuel's user avatar
  • 11
1 vote
0 answers
15 views

Changing Post Status from Pending to Publish twice daily

I have setup a function to change post status from Pending to Publish for posts in a specific category. The function works perfect if I run in under init, but doesn't work correctly if I run under a ...
jberg's user avatar
  • 11
2 votes
1 answer
65 views

WP CLI switching post status from publish to future not working?

I want to use wp cli to change post status from published to future, however it appears that once a post is published, it can no longer be switched to future. When I try to do this the post remains ...
user2491463's user avatar
0 votes
1 answer
33 views

Why does my function create extra empty files?

The code below, added to functions.php, is saving the texts (pre-formatting) of the posts when they are saved, published, or updated. During the first run, I also added save_all_post_to_database() to ...
Yulia V's user avatar
  • 115
0 votes
1 answer
200 views

Set post status to draft after validating post meta values in save_post hook

I have some custom meta values to a custom post type ('event'). The custom post type is displayed in the admin and the custom meta fields are appearing fine. I am using save_post_{$post->post_type} ...
sariDon's user avatar
  • 265
0 votes
0 answers
96 views

transition_post_status hook, works - but not if the post is new

I have no idea whats going wrong. My transition_post_status function works if the post is saved as a draft or another status first, then saved again as the 'transferring' custom post status, which it ...
Yasmine Finbow's user avatar
0 votes
1 answer
167 views

Change Post status based on custom field date +1 day

I have a working script to "expire" a post based on the data of a custom field. The post "expires" (status changes to a custom status archived) on the same day as the ...
nomade0's user avatar
  • 27
1 vote
1 answer
1k views

Change a Post's Status based on the date from a custom field? (for Event posts)

I've found many posts on this topic and tried to use their solution, but none has worked so far... I have an Event custom post type with an event_end_date custom field. I'm trying to create a PHP ...
nomade0's user avatar
  • 27
1 vote
0 answers
59 views

Give attachments an archive page, and exclude unattached ones

I am extending the use of Media/"Attachments" so that they have a custom taxonomy of "Medium" and I can display taxonomy archives on the frontend. I'd only like the archive query ...
kanga's user avatar
  • 111
0 votes
0 answers
210 views

How to change post status to draft in Gutenberg?

I am writing a plugin for my own learning. With add_meta_box I have added some fields. There is a check for empty fields. If the required field is empty, the user sees an error message and the entry ...
VladSiy's user avatar
0 votes
1 answer
31 views

Change user role when user's first post gets published

On my websites the contributors (user role contributor) are allowed to post posts. All their posts are not published automatically (these posts are with pending status). After approving their first ...
István Bálinth's user avatar
0 votes
1 answer
98 views

custom post type, hide or disable the status line in publish meta box

I have been adding a post type to my theme, how do I hide/disable the status line (All of it) as in image
jamesnelson82's user avatar
0 votes
1 answer
488 views

How can I restore posts from 'trash' with their previous post_status? - Wordpress

I have a Custom post type in wordpress in which when creating a new post 3 child subposts are created automatically. For example, I create the post and assign it some status 'Publish', 'pending', '...
JoseFranc's user avatar
  • 101
0 votes
0 answers
300 views

How to return a 410 code for previously published posts now set to draft?

I'd like to return a 410 code for posts (of custom type "news") which have previously been published (and therefore have a url indexed by search engines), but have now had the post status ...
mistertaylor's user avatar
1 vote
1 answer
386 views

Show scheduled posts in main loop but not in WP_Query?

The blog page should show scheduled posts in the main loop. I've done that with this code: /** * Show scheduled posts in main loop */ function fa_show_scheduled_posts( $query ) { if( $query->...
Elizabeth's user avatar
  • 347
1 vote
1 answer
1k views

wp_query ignoring custom post_status

I have a custom post status called 'dead.' I am trying to create a wp_query to show all posts for a custom taxonomy. If I specify 'any' for the post_status I do get published posts and my 'dead' ...
Mojamba's user avatar
  • 104
0 votes
0 answers
102 views

Set Post Private if no linked Post Objects (ACF)

I have created 2 custom post types (using CPT UI). Parent and children. Many children can be associated to one parent using a post object field(add_to_parent). I would like the parent post type to be ...
Woodey Gundry's user avatar
0 votes
1 answer
210 views

retrieve post details in loop

I have written a function to loop through the users posts, and im trying to display each of the posts by their status, with a different message for each status group. for some reason - get_post_status ...
DCEXC's user avatar
  • 7
0 votes
1 answer
168 views

How can I specify the post status of an untrashed post?

By default Wordpress assigns the draft status to a post that has been untrashed. I would like to assign the pending status to posts that are untrashed. This seems to be possible with ...
mike23's user avatar
  • 5,981
0 votes
1 answer
218 views

How can I style future post?

I'm showing published and future posts on a category page. I need to make future posts unclickable and add a special class to them in order to add a gray overlay, meaning the post is upcoming.. trying ...
blogob's user avatar
  • 137
2 votes
1 answer
320 views

How to set a Post's default visibility to 'Private' in Gutenberg?

I am trying to set a Post's default visibility to 'Private' when a user first creates the post. They should then have the ability to manually select 'published' from the sidebar dropdown once they are ...
Bmillerz's user avatar
0 votes
0 answers
15 views

Fetch ids of live posts only (not posts with other statuses) and change status with a button in candidate dashboard

I have added a button in posts list in candidate dashboard that changes status of all posts to "offline" first, then updates the current post to "publish". I want to do this: fetch ...
Hasan Cheeta's user avatar
1 vote
0 answers
269 views

how to do a processing Orders into Complete after x Minutes or x hour in WooCommerce [closed]

I have tried this code its works only one time. help me and check where I am wrong. code goes in child theme function.php add_action( 'woocommerce_order_status_changed', '...
Muhammad Waqas's user avatar
1 vote
0 answers
10 views

Can't schedule post for another time

Very odd thing happening - suddenly, I can't click on the "Edit" link under the Publish options. That is, I can hit "Publish" but if I want to change the publishing date/time or ...
CJ P's user avatar
  • 11
0 votes
2 answers
291 views

get_comments with post_status 'public' retrieves NULL result

This is my loop: <?php $comments = get_comments(array( 'status' => 'approve', 'type' => 'comment', 'number' => 10, 'post_status' => 'public' )); ?> <ul class=&...
MultiformeIngegno's user avatar
0 votes
1 answer
188 views

Any way to change post/page status when editing page?

Pre-Gutenberg, in the “Status & Visibility” panel, there used to be a way to change a Post’s status from “Published” to “Draft” or “Pending Review” – is that just gone now? The only way I can see ...
Michelle's user avatar
  • 3,438
0 votes
0 answers
828 views

Updating post status via rest api

I am attempting to remove/hide a post via the REST API and having issues. Currently, I have tried sending the payload as: { 'status':'private' } And I send the request to: /wp/v2/posts/<id ...
Andrew R's user avatar
1 vote
1 answer
462 views

Send email with custom fields after new draft is saved or new post published

I have a custom post type immobile with some custom fields created with Toolset Types. I need to send and email with the title and a custom field when a new immobile is saved as a draft or it's ...
Pacicio's user avatar
  • 21
1 vote
0 answers
38 views

Featured image overlay when changing post status

I have a car brokerage in Spain with wordpress website using the MOTORS theme from Themeforest. Out of the box, the theme didn´t have all the functionality I wanted, primarily the ability to mark cars ...
Dan Perks's user avatar
0 votes
1 answer
142 views

Custom product status get filtered on all product list views

I registred a new product status with this code : function register_custom_post_status(){ register_post_status( 'invalid', array( 'label' => __( 'Not valid',...
Tonino's user avatar
  • 1
0 votes
1 answer
2k views

Accessing private posts through REST API, same code that works in remote doesn't in local

I am capable of fetching private posts through the wp rest api by calling mydomain/wp-json/wp/v2/posts?status=private&slug=whatever I am authenticating well and receiving a valid token, no ...
GWorking's user avatar
  • 165
1 vote
1 answer
96 views

Second transition_post_status hook fired instead of the first

I'm using transition_post_status to move a post into another post type based on the $new_status, I had made two hooks but the second one always firing first even though the $new_status is 'publish'. I ...
niznet's user avatar
  • 13
2 votes
0 answers
976 views

Remove 'private' and 'pending review' options from post status dropdown

I don't know how to remove these two options (private and pending review), for non admin users. This is a custom post type.
user avatar
1 vote
1 answer
538 views

WordPress post_status is future, manually added

My time zone is UTC+1. Now (and when the post creates the database): 2019-12-16 08:06:00 GMT (now): 2019-12-16 07:06:00 INSERT INTO `wp_posts` ( `ID`, `post_author`, `post_date`, `post_date_gmt`, `...
soosdani29's user avatar
0 votes
0 answers
71 views

Show custom post status when logged out

Background: I have a few different custom post status on my installation. We use them for a workflow. Lets just say for example we have: Draft (built in) ForClient (custom) Published (built in) Now ...
Justin J James's user avatar
0 votes
2 answers
1k views

Published post auto change status to pending after 90 days

I registered a custom post type "job" to create job board site. Without a plugin, how can I make the posts auto change status to pending after 90 days? I am new in WordPress & PHP. I tried some ...
Bryan's user avatar
  • 5
0 votes
1 answer
339 views

How to hide private posts even if user is admin

Even if admins, I dont want to view private posts for custom post type. Added the following code. function my_function( $query ) { if ( ! is_admin() && ( is_singular( 'my_post_type' ) || ...
pimstak's user avatar
0 votes
1 answer
301 views

Woocommerce - Remove cart button depending product (post) status

I created (copied) a custom post status for my old/discontinued product in my function.php and everything is working fine. Now, I want to make those old product unpurchasable by removing the cart ...
Kentin.R's user avatar
1 vote
1 answer
165 views

Custom post type suppress transition from future to publish

I've scheduled a custom post type to a future datetime. Now I won't that it will be published automatically, instead it should switch the status to draft. We use this to pulish the webinars, so we ...
aswiss's user avatar
  • 33
0 votes
0 answers
255 views

Update post status from “publish” to “trash” prior to year 2018

I want to update all posts with status from published to trashed or delete permanently. whose published date is 2018 and previous using WordPress cronjob. Example: If I have 209085 posts, 500 posts ...
Tansheet Ali Taj's user avatar
1 vote
0 answers
350 views

transition_post_status not working via Quick Edit

I am trying to use transition_post_status with custom post statuses to update user meta each time a post status is updated. The following works when editing the post status in Edit Post Screen, but ...
Jay L.'s user avatar
  • 11
0 votes
0 answers
635 views

Transition_Post_Status hook not working properly

When I run this code, the $cptnumber variable doesn't receive the custom post type number when I set a published post to draft. (For example: 367) It works when I trash a post, but not when I change ...
Jordan's user avatar
  • 101
1 vote
1 answer
486 views

How can I set a Post's default visibility to private and pending review checked

there are 2 things I'd like to do: 1. set a post's visibility to private by default. I've been looking around the web for a code or even a plugin that lets me do this. The problem I've run into is ...
junji's user avatar
  • 21
0 votes
1 answer
703 views

edit.php all post not working

i am using publish press plugin to create a custom post status i changed the all post status into public, using this register_post_status( $status->slug, [ 'label' => $...
thamarai selvan's user avatar
1 vote
1 answer
211 views

How to limit post of custom post status?

I have a custom post type 'Commercials' and custom post status 'Featured'. Now I want only one featured post. What I mean is right now I can make all posts as Featured, but I want only one to be ...
Muhammad Russell's user avatar
0 votes
0 answers
2k views

If click on Save/Publish change Post Status to Pending Review instead Publish

Here's my problem. I need following solution. If a user is in the admin area of Wordpress and is not an administrator - and creates a page or product(via WooCommerce) - that if this user clicks on ...
xlimit91's user avatar
0 votes
2 answers
341 views

Include future posts in tags and in search

I am using something like this to query and display future or scheduled posts on my homepage: <?php query_posts('post_status=future&posts_per_page=10&order=ASC'); while ( have_posts() ) : ...
ben.kaminski's user avatar
1 vote
3 answers
5k views

What differences are there between a Privately Published post and a Draft post?

WordPress has three different post statuses: Published Pending Review Draft It also has three different visibility options: Public Password protected Private When you set a post to Published and ...
Pikamander2's user avatar

1
2 3 4 5 6