0

I disabled Gutenberg web builder/ editor using the following code:

add_filter( 'use_block_editor_for_post', '__return_false' );

Somehow this impacted contributor's capability to submit post for review, now contributor's posts are not asking any approval. I tried to remove the capability manually, by writing this code,

$role->remove_cap( 'publish_posts' );

but this code also has no effect at all.

It seems a WordPress bug, any suggestion?? It's showing the same results with https://wordpress.org/plugins/classic-editor/ plugin too.

enter image description here

5
  • "contributor's capability to submit post for review" this is not a core functionality. What plugin are you using for it? Have you contacted their support?
    – kero
    May 27 at 10:59
  • create one user, assign role to contributor, when they will write a post or commit a revision, that will go to admin for approval (core functionality), now disable gutenberg web builder, now when they will create a post or will commit any revision, it will be published immediately (bug), I am not using any plugin till now
    – Ricky
    May 27 at 11:08
  • To my knowledge there is no approval process in WordPress. Do you mean that they create drafts and admin will publish these?
    – kero
    May 27 at 12:15
  • yes, kind of, check attached image, I have updated my question
    – Ricky
    May 28 at 4:36
  • @kero there is sir, may be you are not aware of, not a big task, not all deal with all the roles, you can check/ test this by yourself, it's 5 mins work only
    – Ricky
    May 28 at 4:43
1

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;
}
2
  • worked, thanks a lot!!
    – Ricky
    May 28 at 6:53
  • keep coding & keep learning :) May 28 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.