Change Admin Bar “Visit Site” URL

The admin bar is using the home_url() function which you can modify the result by using the “home_url” filter, this will change a lot of links on your admin area so looks like it’s not the best solution, anyway remember to use the is_admin() conditional tag or you will affect everything on the front end … Read more

How to remove howdy dropdown menu content

You can use wordpress nodes to customize profile menu. Add this in functions.php add_action( ‘admin_bar_menu’, ‘remove_my_account’, 999 ); function remove_my_account( $wp_admin_bar ) { $wp_admin_bar->remove_node( ‘my-account’ ); } add_action( ‘admin_bar_menu’, ‘add_logout’, 999 ); function add_logout( $wp_admin_bar ) { $args = array( ‘id’ => ‘logout’, // id of the existing child node (New > Post) ‘title’ => … Read more

Load JS Script only for custom post types

To enqueue scripts on the front-end, the hook should be wp_enqueue_scripts, not login_enqueue_scripts. Also, a better way to see if you’re on a single custom post type is to use is_singular() and pass the post type you want to check: if ( is_singular( ‘events’ ) ) { } get_post_type() relies on the global $post object, … Read more