Hi @nathaniel45,
you can visit Settings > Duplicate Post, third tab Display and disable the “Admin bar” option, then save the settings. This will completely hide the admin bar commands.
Let us know!
I was hoping to remove it in one area not everywhere.
Hi @nathaniel45,
oh, I see now!
Then you should actually use a snippet of code like this:
add_action( 'wp_before_admin_bar_render', 'custom_remove_menu', 11 );
function custom_remove_menu() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'duplicate-post' );
$wp_admin_bar->remove_menu( 'new-draft' );
$wp_admin_bar->remove_menu( 'rewrite-republish' );
}
This is needed because you may actually have a menu with two commands, or just a link with the “New Draft” or “Rewrite & Republish” commands.
Also this way you are sure that the code runs after the Duplicate Post code has added the menu/links.
I have tried
add_action( ‘wp_before_admin_bar_render’, ‘custom_remove_menu’, 11 );
function custom_remove_menu() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( ‘duplicate-post’ );
}
but didn’t have the other 2 and it wouldn’t remove it. I’ll give it another try and let you know.
Hi @nathaniel45,
We haven’t heard back from you in a while so we’re marking this issue as resolved due to inactivity.
You’re welcome to create a new forum topic if you have any other questions.
Thanks for understanding!