transition_post_status doesn’t work with bulk updates
Change your action to pending_to_publish. add_action( ‘pending_to_publish’, ‘bang30_publish_pending_response’, 10, 3 );
Change your action to pending_to_publish. add_action( ‘pending_to_publish’, ‘bang30_publish_pending_response’, 10, 3 );
A two-part answer below – As above: the broad solution was to save the posts first as draft, then update them with the custom fields and terms, and only then set them to publish. As I said, the above code modification had succeeded in setting the posts to draft but not in transitioning them to … Read more
If you look at the source for the function, you can see that the arguments to the function are passed directly through to get_pages(). That function supports a post_status argument that can be an array of statuses. So to do what you want all you need to do is pass the post statuses you want … Read more
You can hide them using CSS. Add this to the theme’s functions.php file, or add a plug-in header to the top of the file and zip it up to use as a plug-in: <?php add_action(‘admin_print_styles’, ‘remove_this_stuff’); function remove_this_stuff() { ?> <style> #misc-publishing-actions, #minor-publishing-actions { display:none; } </style> <?php } ?>
To achieve the intended result you will have to modify the query by adding the future value to the post_status parameter via the pre_get_posts filter hook. add_action( ‘pre_get_posts’, ‘se338152_future_post_tag_and_search’ ); function se338152_future_post_tag_and_search( $query ) { // apply changes only for search and tag archive if ( ! ( $query->is_main_query() && (is_tag() || is_search()) ) ) … Read more
This is one of those questions that seem easy enough, but are actually quite complicated. If you don’t want to use an existing plugin, you’ll have to write your own (and hence learn more php as this is not a please-write-my-code-for-free-site). Here’s an outline. First you will need to select all the posts of type … Read more
The problem was that I didn’t completely clone the wp site, and I forgot to install the plugin that I used to manage user roles The plugin is Members (“User Role Editor by Members – Best User, Role and Capability Management Plugin for WordPress”) by MemberPress, and there I can allow the roles that I … Read more
When editing a page, click on the cog wheel in the upper right corner to ensure the sidebar displays. There should be two tabs: Document and Block. Make sure Document is selected. There is an accordion item called Status & visibility, among Permalink, Discussion, and Page Attributes. If you click on Status & visibility to … Read more
Try ‘post_status’ => ‘publish’, that should do the trick. See https://developer.wordpress.org/reference/functions/get_post_statuses/ for more details.
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_filtershook is used to call callback functions created by us, like a … Read more