admin管理员组文章数量:1291698
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 / plugin too.
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/plugins/classic-editor/ plugin too.
Share Improve this question edited May 28, 2021 at 4:36 Ricky asked May 27, 2021 at 9:40 RickyRicky 538 bronze badges 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 Commented May 27, 2021 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 Commented May 27, 2021 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 Commented May 27, 2021 at 12:15
- yes, kind of, check attached image, I have updated my question – Ricky Commented May 28, 2021 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 Commented May 28, 2021 at 4:43
1 Answer
Reset to default 1add 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;
}
本文标签: phpHow to keep the capability of users and disable Gutenberg editor in WordPress
版权声明:本文标题:php - How to keep the capability of users and disable Gutenberg editor in WordPress? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741533659a2383905.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论