Skip to content

Instantly share code, notes, and snippets.

@danielsneijers
Created January 8, 2013 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielsneijers/4483319 to your computer and use it in GitHub Desktop.
Save danielsneijers/4483319 to your computer and use it in GitHub Desktop.
Add an item to the Wordpress admin bar. Useful for quick links to settings!
<?php
function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
'parent' => false, // use 'false' for a root menu, or pass the ID of the parent menu
'id' => 'cache_settings', // link ID, defaults to a sanitized title value
'title' => __('Cache Settings'), // link title
'href' => admin_url( 'options-general.php?page=wpsupercache'), // name of file
'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
));
}
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment