You can hook into the pre_post_update
action hook, and check both post’s category and editor. Here’s a quick example:
// Hook to save_post to do some checks
add_action( 'pre_post_update','wpse315124_save_post_check' );
function wpse315124_save_post_check( $post_id, $post_data ){
// Check user's role and post's category
if(
has_category ( 'some-category', $post_id ) &&
current_user_can( 'editor' )
) {
// Stop the script
wp_die( __( 'You can not edit this post.' ) );
}
}
You can also run additional tests, such as get_current_user_id()
and check the id to match specific users/categories.
Related Posts:
- Category’s Description field as editor remove tag
- How to view Plugin Manager in Notepad++
- Is there a plugin that provides a stackoverflow style editor for wordpress? [closed]
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- How can I allow commas in tag names?
- Get a button for in the Editor
- Drag-and-drop “Panels”-style visual layout editor?
- Way to force media uploader use custom image size
- Disable text tab on WordPress text-editor
- Restrict individual category combinations
- Qtranslate displays empty categories with get_categories()
- Plugin for changing a post’s category based on it’s post date?
- Woocommerce category description as subtitle
- Get subcategories with JSON API plugin
- Give editors access to particular plugin – turn “admin.php” into “edit.php”
- How to show custom static content at top of each category page?
- How to use get_categories() with Event Organiser plugin
- Server-side subscribe by email?
- plugin for wp_list_categories with posts
- Set a category for a page
- CKEditor: Uncaught TypeError: switchEditors.switchto is not a functiononclick
- How do you remove plugin edit option?
- Show Heirachy of categories in WP Download Monitor
- How can i list random post from multiple category?
- Support for simultaneous editing
- My Category is too big on the Menu what can i do?
- Not able to open category post [closed]
- Advanced Custom Fields plugin – get text from editor field and save it in a variable
- WordPress JSON API remove posts from a specific category
- Easy Digital Download Sub category
- How to display only subcategory
- Assign post format to categories
- Calendar Solution: Handling upcoming Dates with Posts?
- Events Plugin that works with existing categories?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Display by Category in Admin
- Search for categories
- Customize permalink wordpress category id
- Delete mobile menu button [closed]
- Custom Pages for Woocommerce Product-Category Pages
- How to password protect a category page / not posts?
- Trouble adding tiny mce to textarea in custom plugin
- Using arbitrary paths in page urls
- How do I apply style to each category of a list?
- Redirect to another page using contact form 7? [closed]
- Recent posts per category loop?
- Is changing post from category in a large blog a good practice?
- Access post title from custom meta box on title change
- check uncategorized category by default
- Show WordPress Plugin Menu(Admin) To Editor
- WooCommerce Hiding A Certain Category From Being Displayed On Single Product
- How can i listing current category and Featured Category post list?
- Categories from front-end, checkbox selection doesn’t work
- Edit part of a post
- Is there a syntax highlighting plugin for HTML View? [duplicate]
- How to get Recent Post From Each Category with Thumbnail?
- Plugin for visitors to edit content without logging in? [closed]
- Category “same post” retreive and display
- How to permanently show Word Counter on Create/Edit Page. WordPress5.9.3
- Add a new category for posts
- How to overwrite the category template in a plugin
- How to hide featured images of all posts falling under the same category in wordpress?
- Visual composer custom element error
- Is classical wordpress eidtor a good option for me to include a large table with a large number of images on my webpage?
- How to display the category name in the tab and post inside the tab in WordPress?
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- WordPress default post categories meta box widget
- Images are broken in Wysiwyg Editor – ACF backend
- What plugin would make this happen? If is the theme
- Failed to load resource: the server responded with a status of 500 () post.php
- Unset plugins on front-end belonging to specific category
- Trying to remove a couple categories from shop page
- Category as Subdomain for One WP Install
- Ajax Load More on Hierarchical Categories
- Sub Categories in drop down menu
- How can I display a list of only categories which are marked as ‘featured’ in the backend?
- View more posts of a sub-category
- trying to create simple plugin to filter categories from all authors
- Better code/text editing for posts and pages?
- Filter html of WordPress editor in visual mode only
- Show all posts of all categories but excluding a category on custom blog page with pagination of my theme
- Editor have not permissions for a plugin
- Is it possible to setup Category wise Subsciption?
- Working on fixing wp-front-end-editor, encountering undefined index
- How to add character to content of post?
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- single.php fires more than once after clicking on any post to view with different post id each time
- How can I add the custom taxonomy categories to the posts and pages?
- Twitter List Tweets and Delicious Links as Posts
- WordPress “Categories to tag converter” not working on imported Blogger posts
- wp_insert_post_data filter to set category
- What happened to WP No Category Base?
- Is there a way to combine categories and their hierarchy into the admin listing page?
- How can I replace the built in WordPress editor?
- Save post to category with gravity forms (post_data) [closed]
- Make a Custom template for a specific category in wordpress
- woocommerce retriving category name as div class?
- query_vars in plugin when using custom permalinks
- How to make horizontal scrolling menu [closed]