Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mckernanin
Created December 30, 2015 21:36
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 mckernanin/d6246794362c0f56ace3 to your computer and use it in GitHub Desktop.
Save mckernanin/d6246794362c0f56ace3 to your computer and use it in GitHub Desktop.
Conditional link in admin bar, based on site URL private Add new snippet
<?php
function migrate_db_admin_bar($wp_admin_bar){
$args = array(
'id' => 'wp-migrate-db-pro',
'title' => 'Migrate DB Pro',
'href' => '/wp-admin/tools.php?page=wp-migrate-db-pro',
'meta' => array(
'class' => 'wp-migrate-db-pro-button'
)
);
if (strpos(site_url(), 'stage')) {
$wp_admin_bar->add_node($args);
}
if (strpos(site_url(), '.dev')) {
$wp_admin_bar->add_node($args);
}
}
add_action('admin_bar_menu', 'migrate_db_admin_bar', 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment