disable wp admin bar for customers logged in

If you look at user profile in WordPress administration you would see that there is an option: Show Toolbar when viewing site. If you uncheck this option user will not see an admin bar. This option is checked by default when user is registering to your store. You can disable it using user_register filter. function … Read more

How to disable users to view Other pages

<?php add_filter(‘pre_get_posts’, ‘my_current_author_posts’); function my_current_author_posts( $query ) { global $pagenow; // Check if you are on the right Admin page, do nothing if not if( ‘edit.php’ != $pagenow || ! isset( $_GET[‘post_type’] ) || ‘page’ != $_GET[‘post_type’] || ! is_admin() ) { return; } // get current user Object $current_user = wp_get_current_user(); // check user … Read more

Show admin bar to editors with Buddypres

Please see https://codex.wordpress.org/Function_Reference/show_admin_bar. With newer version of WordPress you may need to use the following which will leave the Toolbar available in the Dashboard but hide it on all front facing pages. So instead of show_admin_bar(true); you can use add_filter(‘show_admin_bar’, ‘__return_true’);

Admin Bar – Customizer Label Change

You can use the get_node function and admin_bar_menu action. Like so, function edit_customizer_node( $wp_admin_bar ) { $customize = $wp_admin_bar->get_node( ‘customize’ ); if ( $customize ) { $customize->title = __( ‘Customize Theme’, ‘text-domain’ ); $wp_admin_bar->remove_node( ‘customize’ ); $wp_admin_bar->add_node( $customize ); } } add_action( ‘admin_bar_menu’, ‘edit_customizer_node’, 999 ); This can be placed in your theme’s functions.php file. … Read more

Admin Bar Acting Up

Try adding this code to your theme functions.php file: if ( is_user_logged_in() ) { show_admin_bar( true ); } If this doesn’t work, try logging into your site using a new “Incognito” window and see if the Admin Bar shows up on the front end. If it does, you probably need to clear the cookies for … Read more

Admin bar default color scheme for nonregistered/nonlogged users

Follow these steps: Use the following code in your functions.php or your site specific plugin: function set_default_admin_color($user_id) { $args = array( ‘ID’ => $user_id, ‘admin_color’ => ‘coffee’ ); wp_update_user( $args ); } add_action(‘user_register’, ‘set_default_admin_color’); Now, add these lines to force “Coffee” color scheme to be displayed in the admin bar: if ( !current_user_can(‘manage_options’) ) remove_action( … Read more

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