Hide top admin panel for non admin and non editors

This is what i am using; add_action(‘init’, ‘blockusers_init’); function blockusers_init() { if (is_admin() && !current_user_can(‘administrator’) && !(defined(‘DOING_AJAX’) && DOING_AJAX)) { wp_redirect(home_url()); exit; } } It’s possible the best one. EDIT : You need a custom login page for reach wp-admin. This code redirect to homepage if you enter directly to wp-admin.

Echo Option Value Based On WordPress User Role

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>’; } }

Streamlining what roles and users see

There are a couple of options here. One, which I’ve found the easiest, is to move content you want to protect into custom post types. From there, you create specific permissions (capabilities) for each CPT, and WP will automatically only show the content that the current user has permission to edit in the back end. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)