I think for your purpose wp_untrash_post_status
filter will be enough. Will work with single and multiple posts restore.
Filters the status that a post gets assigned when it is restored from the trash (untrashed).
add_filter( 'wp_untrash_post_status', 'change_untrash_post_status');
function change_untrash_post_status($status){
return 'pending';
}
P.S. apply_filters
hook is used to call callback functions created by us, like a snippet above, so apply_filters
will fire a callback function which we added with add_filter
(As I understood wp logic right)
Related Posts:
- wp.getPosts with status = ‘trash’ using node.js
- wp_headers vs send_headers. When to use each?
- How many filter/action hooks are healthy?
- Earliest hook to reliably get $post/$posts
- Remove Editor From Homepage
- What does (10, 2) mean when used with add_filter
- Valid characters for actions, hooks and filters
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- How to check if a hook is hooked or not?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Store source permalink on XMLRPC calls
- How to make post and comment count unclickable with dashboard_glance_items hook
- Hook into admin post list page
- How do I know if author field was changed on post save?
- About Hooks and Filters
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- changing variable through filters or action hooks
- Too many actions/filters!
- Apply a filter only once
- How to get list of all hooks of current theme / plugin?
- Making a class available via actions filters
- Anonymous function is executed twice in wp_head while added from the_posts filter?
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- Filter list by a unique meta value dilemma
- return values from hooks do_action and apply_filters, which is better
- How to get all the predefined do_action() calls from an active theme
- Is it possible to track down Actions and Filters?
- When to use actions and when to use filters
- Return a custom value in a function added to an action hook
- Same Conditionals Not Working on Two Different Hooks
- get_header and hook avoid normal call
- Can the wp_filter object hold multiple values with the same key
- apply_filters/do_action tag characters limit
- Is there a filter called ‘network_admin_init’?
- Filter taxonomy admin pagination
- Insert term when page is published – avoid duplicates after edits
- Are there actions or filters I can use for Ajax calls?
- Change name of existing post status type
- Capture post content before page renders
- Correct method of redirecting user login
- How to remove action with slashes and arrows?
- Can the wordpress color palettes by changed through Javascript?
- How do I use remove_action on an add_action that uses an array?
- Wrong post_status notice after wp_insert_post_data
- Changing WordPress core without hacking core
- How to pass variables to custom filter from multiple functions
- Comment search plugin
- How to customize the “Insert/edit link” popup box?
- How to get a single hook from wp_head()?
- Add a filter inside an action init
- Is it possible to apply_filter on a wp_ajax_ action?
- Filter for when the post is updated
- Add a filter to an action [closed]
- Filter get_page_by_path()
- Remove actions/filters that are set with create_function()
- Most performant/functional way to add actions/filters?
- Alter existing page contents based on url
- Remove tags without a specific meta key from “choose from the most used tags”
- Add/remove CRON action depending on variable
- How to access page variable inside action hook
- How to include add_filter() in a condition based on $post data
- Admin: how to make a custom list filter button send GET queryvars
- Use has_filter on comment_post
- Echo string in admin panel footer beside version no
- How to change default text for specific post type
- How can I edit comment meta value before it is saved?
- Disable sanitize_file_name on upload without modifying functions.php
- Redirect after post deleted
- Making an add_filter() call from within an add_filter() call
- Plugin default settings hook
- alternative to the_content filter
- Action hook to control access to certain parts of my site
- Finding actual functions added to hooks and filters
- How to pass a variable between filter/action functions?
- style_loader_tag not changing stylesheet to preload
- Adding link options in insert/edit link dialog window
- How to redirect a unique link based on login status
- Hook to change the site URL
- how to use apply filter for Class?
- How can I see exactly what arguments are being passed through a filter so that I may modify them?
- WordPress set featured image to first image of the post
- adding an action inside if condition not working
- Using add_filters() , apply_filter(), add_action() and do_action() in extending a plugin
- Action for opening attachment or manipulating all attachment links
- Put data in my-account/view-order/id/ page
- What action/filter can be used for modifying the page to be rendered?
- Hook inside a hook
- check, if any “add_action” function contains string XXXXXXXXX
- Remove action added from class
- Custom search fields and AJAX support
- Hook into ‘when user logs in’ [persistent login]
- Custom registration field to SQL database
- Updating User Profile on Registration
- Is this correct usage of filters in WordPress [closed]
- How would I remove an inline googleAPI font script in the the parent theme header.php?
- can’t output gray scaled image I’ve created using add_image_size
- Can you call a filter hook by “add_action”?