This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php add_filter( 'show_admin_bar', '__return_false' ); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove WordPress Toolbar for all users | |
* | |
*/ | |
function myplugin_remove_admin_bar(){ | |
return false; | |
} | |
add_filter( 'show_admin_bar' , 'myplugin_remove_admin_bar' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove WordPress Toolbar for users not allowed to publish posts | |
* | |
* @param bool $show_admin_bar Whether the admin bar should be shown | |
*/ | |
function myplugin_remove_admin_bar( $show_admin_bar ) { | |
if( current_user_can( 'publish_posts' ) ){ | |
return $show_admin_bar; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function myplugin_customize_toolbar( $wp_admin_bar ){ | |
// your code here | |
} | |
add_action( 'admin_bar_menu', 'myplugin_customize_toolbar', 999 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customize WordPress Toolbar | |
* | |
* @param obj $wp_admin_bar An instance of the global object WP_Admin_Bar | |
*/ | |
function myplugin_customize_toolbar( $wp_admin_bar ){ | |
$user = wp_get_current_user(); | |
if ( ! ( $user instanceof WP_User ) ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li id="wp-admin-bar-user-url"> | |
<a class="ab-item" href="http://example.com"> | |
<span class="user-url">My Website</span> | |
</a> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customize WordPress Toolbar | |
* | |
* @param obj $wp_admin_bar An instance of the global object WP_Admin_Bar | |
*/ | |
function myplugin_customize_toolbar( $wp_admin_bar ){ | |
$user = wp_get_current_user(); | |
if ( ! ( $user instanceof WP_User ) ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Setup | |
*/ | |
function frontend_user_manager_init() { | |
add_shortcode( 'frontend-login-form', 'frontend_login_form' ); | |
} | |
add_action('init', 'frontend_user_manager_init'); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set a custom login page | |
* | |
* @param string $url Default login URL | |
* @param string $redirect Redirect URL on login | |
* @param bool $force_reauth Whether to force reauthorization | |
* @link https://developer.wordpress.org/reference/hooks/login_url/ | |
*/ | |
function frontend_login_url( $url, $redirect, $force_reauth ){ |