How To View Site from Non-Logged-In User’s Perspective
See this related question. You should be able to add this code to your themes functions.php add_filter( ‘edit_post_link’, ‘__return_false’ );
See this related question. You should be able to add this code to your themes functions.php add_filter( ‘edit_post_link’, ‘__return_false’ );
The problem is that you are loading your script before jQuery has been loaded. Do not print scripts directly. You should (register and then) enqueue them using the provided API. jQuery is already a registered script, so you can just enqueue it (say on the admin_enqueue_scripts hook). However you only need to load jQuery if … Read more
I had a similar problem (albeit 3 years later) and after some research I had a process for potentially identifying the source of the problem and subsequently found that my issue was hidden in a plugin (iThemes Security in may case). The missing Appearance > Editor in WordPress could be due to a number of … Read more
Try using below code to remove administrator and editor option from drop down. Use editable_roles filter function wdm_user_role_dropdown($all_roles) { global $pagenow; if( current_user_can(‘editor’) && $pagenow == ‘user-edit.php’ ) { // if current user is editor AND current page is edit user page unset($all_roles[‘administrator’]); unset($all_roles[‘editor’]); } return $all_roles; } add_filter(‘editable_roles’,’wdm_user_role_dropdown’);
I think you have the visual editor disabled. Go to Users > Your Profile and uncheck “Disable the visual editor when writing”.
I figured it out in the end and this is the code I used: function restrict_menus() { $author = wp_get_current_user(); if( isset( $author->roles[0] ) ) { $current_role = $author->roles[0]; } else { $current_role=”no_role”; } if( ‘contributor’ == $current_role ) { $screen = get_current_screen(); $base = $screen->id; if( ‘edit-post’ == $base || ‘upload’ == $base || … Read more
Function wp_new_user_notification is pluggable. It means that you can override it by declaring your version of this function in your plugin/theme. So, if you wish to disable all notifications completely, do it like this: if ( !function_exists( ‘wp_new_user_notification’ ) ) : function wp_new_user_notification( $user_id, $plaintext_pass=”” ) { return; } endif; However I wouldn’t recommend you … Read more
Avoid native php functions They are not relative, so breaking stuff is easy. (like in the OPs case) Why role your own if core got a function for you? They don’t consider edge cases You should NEVER use the constants STYLESHEET_DIRECTORY TEMPLATE_DIRECTORY WP_PLUGIN_DIR etc… Remember: Those are not API! and can therefore change! but INSTEAD … Read more
The alternative to wp_head action in admin area is admin_head. But, if your CSS depends on another stylesheet, you should use wp_add_inline_style() function hooked to admin_enqueue_scripts action.
Upon request I will write an answer using a function from a suggested answer for the similar question: How to target with css, admin elements according to user role level?. This function will output classes to the body element for all roles of the current user in the form role-XXXXX function wpa66834_role_admin_body_class( $classes ) { … Read more