add these lines in your ‘functions.php’, it will work
//if not gutenberg reapprove posts
add_filter( 'wp_insert_post_data', 're_aprove', '99', 2 );
function re_aprove( $data, $postarr ) {
//check if current user is not admin
if ( ! current_user_can( 'manage_options' ) ) {
if ( 'publish' === $data['post_status'] ) {
$data['post_status'] = 'pending';
}
}
return $data;
}
Related Posts:
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Allow Editors to edit pending posts but not draft ones
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- Editor role cannot save custom theme options
- How do you add customer capability after Woocommerce purchase?
- Add class to group inner container
- Shortcode for Listing Users from Meta Value?
- Query for user roles
- Execute PHP code only with specific user role
- Add Block Before Entry Title Using PHP
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Gutenberg block don’t save rich text content
- Hide payment method based on user role AND minimum cart value
- Is there a PHP function that will return the block ID generated by WordPress?
- register_block_type is not working properly
- Edit a function to take different actions based on user role
- How to give custom roles the capability to edit one Menu instead of every Menu
- Add another role to a user when they click a button?
- Allow BBPress participant role to trash topics
- Get author meta of all writers
- How to add different menu items on different menus?
- Replace block content with an array
- Custom Admin Menu Report for Specific User ID
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- How do I get the author’s page url from their ID?
- Remove class that has been added by parent theme
- How to check from which page the user is coming to the current page?
- Execute only on a certain page
- How do I know what variables are passed in a filter/action and what their meaning is?
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Wrap each shortcode in array to div
- Warning: array_pop() expects parameter 1 to be array, boolean given
- Replace comment avatars and links at the same time
- Check if Product is in a Specific Category in Functions.php
- Display user role Name – not slug
- Adding ads code between comments
- Create Logout Link WordPress Admin Menu
- How to Display Image Meta underneath EVERY image in EVERY post
- Limiting woocommerce line_total decimal length
- Run a filter when a walker runs
- Shortcode content filter?
- Swapping wp_dropdown_categories function with wp_category_checklist
- Display fields as values in array from external SQL DB
- only show container with next/prev links if they exist?
- Populate dropdown with Child Pages based on Parent Page chosen
- How can I remove a function that has been added to wordpress with add_filter?
- JS file work only in index page
- Error in custom php function doesn’t exist
- Custom shortcode outputs plain text instead of HTML at top of post
- how can i use $_COOKIE[] + PostID to execute the below code?
- What’s the uses of wp_cache_set() or wp_cache_add()?
- Create Page To Count Comments For Each Post In WordPress Site
- Can anyone offer any help with this function?
- Shortcode with PHP issue “Undefined index”
- height should be set to auto to avoid pixelation in the post thumbnail function
- Can i put my shortcode inside a variable in php files?
- Moving code from theme header to functions.php
- Override a function defined in wp-includes/comment-template.php
- Show meta box only for default page template
- Can’t access site after making changes to the functions.php [closed]
- Best way to use a large array in function
- Setting user nickname and displayname to shortened email
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Custom meta box values are not getting saved for my custom post type
- Simple AJAX notification when the new post is added to the database
- Create page template via functions.php?
- CSS change in woo commerce Place Order Text [closed]
- child parent styles enqueue order
- Add URL parameter to all internal links using a specific theme
- Warning: call_user_func() expects parameter 1 to be a valid callback, function
- Change MySQL PDO connection to a WPDB connection
- AJAX function not working [closed]
- Modify WooCommerce used to get all orders in dashboard
- Can’t log in to WordPress wp-admin after adding code to functions.php
- How to change basename url for wp-admin?
- Search by date in WordPress
- Hide a div if the fiels is empty
- Illegal string offset checkbox
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- Trying to add some custom text into WordPress Post title via function.php
- I got big white screen when i attach main style sheet of Html in functions.php
- Using Javascript On Page – Header and Footer Now Missing
- Add Product Permalink in woocommerce admin order page
- Unzip_file causing Media file upload error
- How do I make comment-reply-button with that takes to comment reply form on click
- How to generate customized filtered output for the gallery
- Escaping a Single Quote in str_replace for Nav Function
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WordPress rating by views [closed]
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Replace TinyMCE with Custom Built Editor
- Particular meta tag – viewport – insertion when dealing with plugin
- WP Fatal error: Call to undefined function get_template_directory_uri()
- Remove default Image Sizes
- A better way to write this php function
- Generate and upload screenshot as featured image for user-submitted post