Advertisement
firoze

wp admin bar

Feb 22nd, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. // https://codex.wordpress.org/Function_Reference/remove_meta_box
  3. function remove_dashboard_widgets(){
  4. remove_meta_box('menu-plugins', 'dashboard', 'normal'); // Plugins
  5. }
  6. add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
  7.  
  8. // https://codex.wordpress.org/Plugin_API/Action_Reference/wp_before_admin_bar_render
  9. //https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/admin-bar.php#L88
  10. function firoze_wp_admin_bar(){
  11. global $wp_admin_bar;
  12. $wp_admin_bar -> add_menu(
  13.  
  14. array(
  15. 'id'=>'google_analytics',
  16. 'title'=>'Google Analytics',
  17. 'href'=>'http://google.com/analytics',
  18. 'target'=>true
  19. )
  20. );
  21. $wp_admin_bar -> add_menu(
  22.  
  23. array(
  24. 'id'=>'facebook_analytics',
  25. 'title'=>'Facebook Analytics',
  26. 'href'=>'http://facebook.com',
  27. 'target'=>true
  28. )
  29. );
  30.  
  31. }
  32. add_action('wp_before_admin_bar_render', 'firoze_wp_admin_bar');
  33. // add_action( 'admin_bar_menu', 'firoze_wp_admin_bar' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement