• Resolved nathaniel45

    (@nathaniel45)


    How can I remove duplicate post from the admin bar? I have a custom plugin I don’t want it shown in. I have tried $wp_admin_bar->remove_node(‘duplicate-post’); $wp_admin_bar->remove_menu(‘duplicate-post’);

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Enrico Battocchi

    (@lopo)

    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!

    Thread Starter nathaniel45

    (@nathaniel45)

    I was hoping to remove it in one area not everywhere.

    Plugin Author Enrico Battocchi

    (@lopo)

    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.

    Thread Starter nathaniel45

    (@nathaniel45)

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘remove duplicate post from admin bar’ is closed to new replies.