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
- featuring old articles without messing up with the archive
- Make “Post published. View post” Open in a New Tab
- 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
- Send email to user that his post has been rejected
- Add filter-by-tag in the all posts admin console page
- 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?
- ‘transition_post_status’ only fires when pressing “Add New”
- Change Order of Admin Posts Depending on Meta
- Diplay comment date on WP_Post_Comments_List_Table
- Change default Posts page
- How can I set a Post’s default visibility to private and pending review checked
- I am unable to publish/update post
- Disable inline_edit() on edit.php
- How to change post status from frontend?
- Display Meta Values in Custom Filter – Admin Custom Posts
- Lost draft under all posts and drafts
- Posts and Attachments with “Published” status in Search
- Admin – create custom post status and display above table
- Simultaneous admin updates causes custom fields to not update
- Hook in to add new post link wp admin?
- Restrict edit, but allow preview for custom post status
- WordPress capabilities on pending post status
- plugin to post from admin to flickr [closed]
- Retrieve only posts from a specific user in wp-admin/edit.php
- Adding an Archive button to posts page for administrators
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- How show categories in admin and get that selected to show posts in index
- $post->post_type not working
- how can i allow users to view their own pending posts in a front-end page
- Change post-slug using wordpress API? Change permalink of a post using php / jquery?
- Fast publishing in wordpress
- How to get the old WordPress Draft Editor view back with the Word count?
- Is there a way getting post fields using `transition_post_status`
- Post Status Frontend Announcement
- Sort All Posts by Category Name in the Admin Panel?
- Display amount of pending posts in back/front end
- List latest posts with least comments in WP-Admin
- Lightbox on wordpress post page
- Showing posts for today and future
- Some blog posts containing source code fail to save draft or publish
- Show Last Revision Of Post That Has A Published Status On Single Page
- How can I restore posts from ‘trash’ with their previous post_status? – WordPress
- WP_Query outputs wrong post in custom post type
- Edit post & page option does not display on latest wordpress
- 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
- Redirect old Posts URL to new URL
- 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
- 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
- Many buttons not functioning in WordPress dashboard (as 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?
- issue in wordpress auto delete post and redirect to another 1
- Admin is showing all posts on page 1
- 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
- Creating a new Sortable Column in WordPress Admin
- 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
- Add News Feed to bespoke website, only to one page on whole site
- I cannot see the pagination in /wp-admin posts page
- Set Featured Image of a post
- /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
