The official documentation for wp_untrash_post
documents a filter for setting the status that it will use:
https://developer.wordpress.org/reference/functions/wp_untrash_post/
This filter can be used to return pending
instead as the status.
If that’s not an option though, you could set the post status to pending after calling wp_untrash_post
, it doesn’t have to happen in a single function call, e.g.
wp_untrash_post(....);
$data = [
'ID' => $post_id,
'post_status' => 'pending',
];
wp_update_post( $data );
Note though that if you call just wp_update_post
it will still untrash the post but none of the filters and hooks associated with untrashing will execute, which could cause issues.
Related Posts:
- Post Format Status [closed]
- editPost without undo entry
- How to add an admin notice upon post save/update
- How to Display a List of Users Who Have Made at Least 1 Post?
- Change label of title field for posts in the backend
- Let private posts stay in status “private” after edit through “editors”
- Exclude drafts in all() view of edit.php
- How to Arrange Posts by Size in the WordPress Dashboard?
- List latest posts in WP-Admin
- Open WordPress ‘Add New Post’ admin page with parameters set via $_GET
- using slug instead of ID in admin edit post url
- Categories box not showing on post edit pages
- Include Sticky Post in Page Posts Count?
- featuring old articles without messing up with the archive
- Setting post meta data to random value during post status transition / on publish
- How to change post status from publish to draft using hook in wordpress?
- Make “Post published. View post” Open in a New Tab
- Hiding by default specific post status on backend list?
- How to get new post URL?
- Enable commenting on front-end preview page for pending posts
- How to remove bulk edit options
- Add confirmation popup on “Move to Trash”
- Embed WordPress Admin in an iframe
- Can’t publish, edit or delete posts since Gutenberg update
- Custom Post Status Posts viewable to the public
- Send email to user that his post has been rejected
- Add filter-by-tag in the all posts admin console page
- Remove some articles from the list in WPAdmin for a user
- How to place HTML below the title of the (custom) post overview
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- display list of posts/pages in admin edit post/page
- How can a guest view the “Pending Review” Post?
- Custom Theme Want To Remove One Category From All Displays
- Invalid post type when click “Filter” or “Apply” button in WordPress admin Post list [closed]
- How do I batch create revisions of all posts?
- add filter to “quick edit menu” in wordpress admin
- ‘transition_post_status’ only fires when pressing “Add New”
- How to change the title url on the edit post screen?
- Change Order of Admin Posts Depending on Meta
- What differences are there between a Privately Published post and a Draft post?
- Diplay comment date on WP_Post_Comments_List_Table
- Change default Posts page
- Update post status from “publish” to “trash” for half of posts
- How can I set a Post’s default visibility to private and pending review checked
- WP_Query outputs wrong post in custom post type
- Edit post & page option does not display on latest wordpress
- Cannot create new posts or upload images using media manager
- user_has_cap filter allows “edit_others_posts” but not is not allowing updating/publishing
- ‘QTags.addButton: arg2 distorts the button rather than just shows
- Custom Fields – How to get the list of a specific active widget each time it rendered
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- My page shows some other content in WP
- the wp_post_update isn’t working all the time
- Redirect old Posts URL to new URL
- Updating post status via rest api
- Post count doesn’t match number of posts shown in list in admin
- How to view a post from the wordpress admin screen
- Blog open in new Tab
- Remove status ‘archived’ from the default post and page view
- Strange behaviour in WordPress admin
- How to show WP admin edit page within template page/post?
- WordPress Screen Options, Help, Visual editor, Status, Visibility, Revisions, Published on and any toggled indicator don’t work for posts
- How publish post from pending status
- Hide or remove custom post status
- Put page on Archived statut after end of publication date
- get_next_post() not working with future post status
- Many buttons not functioning in WordPress dashboard (as admin)
- Redirecting to “All Posts” after post publish or update
- Set featured image on creating new post
- Blank page after changing number of post displayed in wp-admin
- How to sort posts in admin by name
- Modify loop to include all post statuses not just ‘published’
- Is it possible to display QUICK EDIT as default for all posts in wp-admin/edit.php page?
- How can I filter the post of a CPT by taxonomy Term in admin meta-box dropdown?
- issue in wordpress auto delete post and redirect to another 1
- How to enable comments meta box for other author posts?
- Admin is showing all posts on page 1
- Post preview in iframe without saving the post
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Function/filter or plugin to change post status based on custom field value
- How to change the publishing date of each posts?
- Error establishing a database connection
- Post thumbnail is not shown in wp-admin
- get_posts includes “auto drafts”?
- Creating a new Sortable Column in WordPress Admin
- Enqueue CSS on custom posts’ backend area
- I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in publish
- What does WordPress mean by they have full rights to content [closed]
- Add News Feed to bespoke website, only to one page on whole site
- Do anything on post_status change [duplicate]
- Display posts with id equal to relationship value
- I cannot see the pagination in /wp-admin posts page
- My website freezes for one minute every time I publish or update a post
- Post type gives 404 unless logged in
- Set Featured Image of a post
- REST API – Retrieving posts with custom status
- /wp-admin/admin-ajax.php Error 500 while using divi premade layout in existing pages
- Implementing Soft Delete for Bulk Actions / Empty Trash
- Mismatch between posts count and actual list in admin posts page
- How to add publish button in menu All Posts (Wp-Admin)