You can ask for roles with current_user_can()
too:
current_user_can( 'administrator' )
or
current_user_can( 'editor' )
There is no built-in role moderator
.
Related Posts:
- Adding a second email address to a completed order in WooCommerce [closed]
- Possible to search by author name with default WordPress search function?
- Advantages and disadvantages of using automatic-feed-links
- Is it possible to override this function/class in a child theme?
- When new user register then add new user role
- Change meta tags programatically
- Convert hyphen to underscore in permalinks
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Use a function to update post meta based on other post meta
- Adding body class when post contains a specific shortcode
- Displaying Widgets
- WordPress registration and contact form 7 [closed]
- Display WooCommerce subscriptions for user [closed]
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Check if row exists before inserting
- PHP files included in functions.php don’t seem to work
- Removing the main link to Jetpack from the menu
- Defining a global array in functions.php?
- How To Remove Duplicate Menu Locations
- Set quantity of woocommerce product on page visit [closed]
- get_post_type() in in_array doesn’t work for some reason
- Show top commenters without using a plugin
- How to remove set_post_thumbnail_size() in child themes?
- WordPress shortcode attributes for database SELECT?
- How to get membership level for specific user email
- Post thumbnail not showing in WP admin area for custom post type
- Backstretch.js and thumbnail sizes to reduce loading time
- Child theme within a child theme?
- Fatal error: Cannot redeclare when switching themes
- How to load jQuery in the footer – nothing works for me
- Featured Image Thumbnail Creation
- Updating Media Published Date When Parent Post Is Modified in WordPress
- WP Ajax Function Always Returning undefined
- How can I grab the video id of youtube?
- Specify number of posts for sub-category page
- how to en-queue jQuery to load before the tag
- Creating A New Admin Menu Tab For Theme Options
- Passing variable as add_shortcode argument
- comments_popup_link without echo?
- Can’t filter wp_get_attachment_link
- Impossible to call wordpress function inside an include?
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Remove a category from a post when saving a new post
- Function extending with if query in functions.php
- add_action wp_enqueue_script priority level only works for admins
- is there a way to remove featured image from blog page and single page
- current_user_can comma list vs OR (||) list
- Include the post type before the title of search results
- What is wrong with code added to functions.php to selectively show styles based on login state
- Writing a function to detect an event
- Adding additional roles on registration
- Problem with calling custom function in a foreach loop
- Different methods of adding menu support to custom theme
- Function to insert missing image size attributes into img tags
- Redirects based on a JSON file
- Get Attachment Category Name
- Sort and display pages with specific custom field (not tag)
- Problem with custom function when I go back with the browser
- functions.php return custom text
- Creating multiple category drop down
- Disable trim in WordPress
- How i can get the URL?
- WordPress Categories: Function using custom SQL to return array of specific category IDs
- WordPress login set cookie that survive browser exit (wp_signon function)
- Show metadata in users.php – wordpress
- Add version # to wp_register_style function
- How to remove font awesome from loading in wp theme
- Customizing the wp_video_shortcode output with add_filter
- a SET of wordpress native galleries with title and text?
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Remove check boxes and its label from screen option for custom role
- Custom Function.PHP Code Not Working on One Site
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- Only display table in the_content() in canonical page
- Button click counter for login user
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- Frontend Feature image upload not work
- Display page number on custom page title function
- different body classes for each category
- How to override or change function in form.php in a plugin
- Some code is added automatically to my site’s header – what is it?
- To make some div display for a longer time
- Getting back a blank WordPress site following functions code edit
- Add functionality to post editor
- A blank page is shown after I add a Function
- Override default password nag in WordPress
- Cant use php fopen() function in functions.php
- Additional Sidebar
- Syntax for a function in order to get post’s title in JSON encoded response [closed]
- Comment Function
- Do something when user creates post (that’s pending)
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- Add product to cart from functions.php
- How I can show short content with short tag
- function to show youtube videos within excerpt – if condition and apply_filters
- Convert Image to Webp on upload without plugin
- How to automatically load Google Fonts on pages only as they’re used?