WP no longer uses role names in this type of function. You need to use
if(current_user_can($capability)) {
where $capability
is a capability like read_posts
, publish_posts
, etc. and not the name of a role like subscriber
or editor
.
Related Posts:
- Getting a list of custom posts by author
- Display Authors Comments on Profile Page
- the_author_posts_link() for authors of custom post types
- Adding %author% in custom post type URL structure?
- Author archive only for custom post type
- Custom loop for custom post type for current author
- Show Custom Post Type by Author
- Recent comments on author page?
- Get the terms of a custom taxonomy for a specific author in author template
- Prevent author role from editing all posts in custom post type?
- Display only custom post type count for current author on the “At a Glance” dashboard widget
- How to fetch custom post by Author?
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Check if author or current user has posts published
- Get Author for Single Post in Custom Post Type
- How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
- How can I show a custom post type for users in the authors.php file?
- WordPress post count not showing for custom post type author
- How Can I Set the Post Author of a Post I Just Created With PHP?
- Custom Post Type and Labels
- Filter post by current 2 differents users id
- How to only show posts assigned to current user, only in certain post types
- get_attached_media() on author page not working
- Permit users with author role to edit a custom post type
- URL rewrite add author as base
- Edit the author of custom post type
- Can multiple authors be assigned on a single custom post?
- How to restrict author to only access one custom post type ?
- How to show featured image block in custom post type for Author?
- Author posts not appearing for custom post type
- Display an authors post on a single page only when they are logged in
- Select other roles as custom post authors
- post body class for current user only if they are the post author
- Restrict category access to specific users/groups. Author always has access
- Find custom post type url by author
- Display latest posts of author in a custom post type
- Custom post type title of each author in his own post
- get post count for related author
- Display author box on just certain category posts?
- Display custom post counts for author , not default posts
- Use Author Ids or Names to echo different output inside loop
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- Showing only posts from the current user who is logged in?
- “Author” custom post type
- how to display author name in custom post type
- Limit custom post type to the authors only on front-end!
- How do I get all authors posts of a custom post type outside loop
- Why is wp_list_authors not picking up Authors from CPT’s?
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Delete Post by User
- Display posts on parent post if author coincides
- Author archive custom posts only?
- Set a static page as a user profile page?
- I want to link an author to everything from any post type that they publish on the website
- Get author image for posts in loop on custom type posts page
- WordPress Author Posts Review After Every Change In The Same WordPress Post
- Custom Post Type Author Array Problem
- Show a custom field instead of username in the backend author area
- Custom Post Type supports author
- Author template – separate custom post type by custom taxonomy term for $curauth
- How is get_the_author connected to a custom post type?
- How to display Author Profile based on Custom field value
- how to show Author post type count
- Emailing Authors only when a CUSTOM POST TYPE post is published- not when edited later [duplicate]
- Get list of all registered post types slugs
- Pagination gives 404 error
- How do you use JavaScript to detect the homepage
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- How to debug a blank page?
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Email friend for each Custom Post Type posts on a page
- Trouble with CPT Child 404
- customise template to only show custom post type entries
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- How to query 2 custom post types that need to share a slug?
- Get rid of “trash can” for custom post type
- Custom Post Type: Show Similar Posts
- Get uri of CPT archive page
- Checking whether post is deleted or saved in edit_post
- Query Custom Post Type by Taxonomy
- Display ONE taxonomy and its assigned pages
- Creating a custom page post type just like the original “pages” post type using CPT UI
- Create a CPT to edit Shortcodes Atts
- Custom post using elementor not displaying correctly
- Error in the page of a CPT file in WordPress
- Custom post type pagination problem – page 1 and 2 show same content
- List posts of custom post type under category name
- Unsure what page hierarchy to use with CPT UI to show on front end
- Capabilities and mapping required for a role to be able to edit other’s posts of a custom type, BUT only be able to edit their own blog posts
- Permalink Problem with Custom Post Type
- Automatically convert standard posts with custom fields to custom post types
- How To Display Category list from Portfolio post type plugin?
- Custom Post Type tag taxonomy “Page Not Found”
- Remove custom post type slug but keep related category taxonomy permalink
- Custom post type category page not working
- Turn off comments for given CPT checkbox?
- Categories in custom post types
- Permalinks for Custom Post Types and Taxonomies
- Group search results by post type, but having a unique heading for each section?