Something like this?
if(current_user_can('administrator')){
echo '<option value="[email protected]">[email protected]</option>';
}elseif(current_user_can('subscriber')){
echo '<option value="[email protected]">[email protected]</option>';
}
Maybe this should be wrapped in a user logged in check like this:
if(is_user_logged_in()){
if(current_user_can('administrator')){
echo '<option value="[email protected]">[email protected]</option>';
}elseif(current_user_can('subscriber')){
echo '<option value="[email protected]">[email protected]</option>';
}
}
Related Posts:
- Editor role cannot save custom theme options
- Select dropdown not showing selected value php
- Multiple options not staying selected after saving
- How to make a pagination with dropdown selection?
- MySQL “Or” Condition
- How to get WordPress Time Zone setting?
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- Custom plugin: Trying to show saved data on frontend
- How to target with css, admin elements according to user role level?
- Remove/unset options field from backend Settings->General?
- Site Title and Tagline in Theme Options Page
- WordPress customizer: load controls in a custom div
- Enqueue Javascript Correctly for 3.5
- wordpress separate registration for different roles
- Passing array in add_option()
- Implement a multi-value input field where the number of entries is not limited
- How do I output a database option that is an array into a get_posts array?
- Delete option value from array using update_option()
- How to get bool with `get_option()` when already registered setting with type `boolean`
- Display user role Name – not slug
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- how to save selection meta data in user profile on frontend
- Add user settings to specific roles
- SQL QUERY – Select a value directly from the database
- Adding Default Settings to Theme My Login plugin
- How to add values to media “whitelist_options” in wp-admin/options.php template?
- How to make drop down post title
- Ajax – Call to undefined function get_option()
- Custom profile field with birthday. Troubles with
- Hiding div based on user role
- Long running queries
- Options API get_option() and update_option() Not Correctly Updating or Returning
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Setting default category base on theme activation
- Do not execute If User is login as Administrator or any Specific Role
- how to update and display an option without reloading the page
- Saving plugin settings – ERROR: options page not found
- wp_dropdown_pages auto submit
- How to convert select to HTML with PHP tags inside of it [closed]
- Add post with approval by the admin
- add onchange to select in a wp form
- Is a series of update_option calls safe, performance wise?
- wp-options keep crashing please help
- WP_OPTIONS table, active_plugins entry [closed]
- Warning: Illegal string offset on theme options page [closed]
- Link blogname and blogdescription to the Options Framework
- retain querystring values when savincustom options in admin
- Why can’t I return a value from $wpdb->get var?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- How to Change CSS Colors from Custom Plugin Settings Page
- Decimal values via get_option() with custom local (decimal point = comma)
- Shortcode for Listing Users from Meta Value?
- HTML dropdown setting not showing last saved value in the database
- Array to string conversion error in PHP 7.2 when returning user role as class
- Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
- Noindex subscriber author page
- WordPress language switcher doesn’t work
- Query for user roles
- Custom Taxonomy Select Menu: Setting default option value?
- Add a select-option to the default widgets
- Display random image url from list of input values
- How can I call a specific file (via php) by referencing the logged-in username?
- Page Options Saving But Not Updating In Backend
- Compare current post Category in select menu
- Plugin: Front-end Editor – User role specific editable content?
- Execute PHP code only with specific user role
- Add a custom WooCommerce settings tab with sections
- How to set value selected using select2 jquery plugin
- Edit and delete permissions pages and posts
- Database SQL query error
- Execute function only for specific user roles
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- Hide payment method based on user role AND minimum cart value
- No more get_option(‘date_time’) in WordPress 5.5?
- Edit a function to take different actions based on user role
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- How to give custom roles the capability to edit one Menu instead of every Menu
- How to update option field in database on clicking the publish button in customizer
- How to properly create multiple conditions to redirect users roles to different pages
- Role exception for a settings sub menu
- Allow BBPress participant role to trash topics
- Use get_option with $emailTo on contact page
- How to connect database table to each registered wordpress user.
- Get author meta of all writers
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Switch-Case and user_role
- Integrating CSS Into a WP Function Call [closed]
- Forbid certain users to access a specific page
- Open WordPress Page from selected option dropdown
- Echo get_option displays as text
- Dynamic Email Handler with ‘header (“Location: …’
- save array of objects with update_option
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress