You’ll have to change see_special_cats
to something fitting. As you want to exclude contributors, but allow all others, you could use publish_posts
(See the codex for all capabilities of contributors).
Your code should be something like
add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2);
function yoursite_list_terms_exclusions( $exclusions, $args ) {
global $pagenow;
if (in_array($pagenow,array('post.php','post-new.php')) &&
!current_user_can('publish_posts')) {
$exclusions = " {$exclusions} AND t.slug NOT IN ('news', 'blog', 'main')";
}
return $exclusions;
}
Keep in mind that you might have to adjust the slugs, which I’ve just assumed are news
, blog
and main
.
Related Posts:
- the_date() not working
- What is the best php version to use with WordPress?
- WP-API v2 Custom Endpoint Response Formatting
- How to call a function only once (global variable scope)
- Multiple is_page() in page.php
- Get author full name
- How to make WordPress plugin check for database changes and then do something?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Extract the first oembed url inserted on the content of a post
- WP API V2 returning Invalid User ID
- Limit the_excerpt with max of x characters
- How can update custom meta for all posts
- wp_get_attachment_url filter won’t accept two arguments
- nowplaying.include.php Will Not Display Results
- Am I not understanding plugins?
- Passing the page ID to a login php script
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- wrong php date()?
- It is a good idea to store values from the global $post if they are used multiple times?
- How do I fetch all comments per post via WP REST API?
- Vagrantpress + composer
- esc_url returns incorrect URL
- Using More Tag in Combination with the_excerpt
- combine Code 1 with Code 2
- Recent posts with featured image or fallback image with permalink
- Custom Form Processing Issue
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- Reordering Buddy Press profile navigation [closed]
- How to set a min number of words for a blog post
- How to sanitize any integer input field in wordpress?
- How can I get the total number of installed importers?
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Change title only in dynamic page
- How to make products with no cost in WooCommerce
- Query Pages and post excerpts dynamically
- two columns of posts on homepage, one of them “favorites”
- Help with .htaccess and Login with Subfolders
- Catchable fatal error on 3.6 update
- AJAX – Returning Two JSON Objects with One PHP Function
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]
- Can’t Query Custom Table Using $wpdb Method
- How can I access string value in an array?
- Defined WordPress Memory Limit to Unlimited
- Update postmeta after theme switch
- WordPress gallery shortag
- Set site title & tagline with wp.config or function.php
- Shortcode to embed Edit Account form not working
- Errors after upgrading PHP to 7.4 WordPress
- How to make jquery count down timer function manually editable
- Get user custom field value on function.php
- WooCommerce – Moving Product Price to the Left of Add to Cart Button [closed]
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- wordpress site – using custom database and PHP
- cURL error 6 on news area, and also won’t auto update
- Woocommerce custom Plugin in wordpress [closed]
- Implementing custom tag/tax pages
- Change homepage content if user is logged in – BuddyPress
- Custom upload folder
- Replace Post-Title with variable
- WordPress loop is not working
- Displaying Event within two given time frames
- How to get my [shortcode] rendered on the home page, other pages are fine
- Display movies that apear this day next
- How to edit background color of only one sidebar?
- Edit and delete permissions pages and posts
- Add custom field on admin dashboard comments / reviews
- How to add JS script in specific pages in WordPress?
- Fatal error login WordPress [duplicate]
- Display one random image from Media Library
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Why is values of a global variable returning blank when inserted into database
- Problem with my Login Plugin
- Suddenly got alert when trying to login to admin panel of wordpress
- How to return html as a string from php for WordPress
- Show Gutenberg facebook embed with a custom theme
- Add code to the header of posts by particular author
- Running a PHP SQL script on a wordpress page
- Taxonomy Child Term, Counter is staying on 0
- How to apply ‘add two more posts’ to media content?
- LinkedIn Share Post Button
- wordpress more than one ajax request at the same time issue
- load a wordpress page into another wordpress page using iframe
- How to display recently modified posts on recent post widget in wordpress
- Explode Content within specific HTML element
- Using get_theme_mod with checkbox to display content
- PHP Shortcode – 500 error
- Non-array argument in array_merge()-function [closed]
- Add specific content after specific text in every post
- Too few arguments for printf() [closed]
- Using existing widget code! [closed]
- Pagenav Not appearing on custom Template
- Dynamically append custom post type to end of url
- Automatically load WordPress page on server every XX hours
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- Pagination in category.php not functioning
- Open WordPress Page from selected option dropdown
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb
- How to modify default tags in wp_head()
- Can’t insert into a database wordpress