Need to remove 'Membership Simulation Menu' from admin toolbar

My users have access to the admin toolbar and each user also can now see the Test Members option in the toolbar.

I do not want them using this. Can someone tell me how to remove or hide this form my subscribers?

Thank you,

Paul

  • Jude
    • DEV MAN

    Hey again Paul

    Can you try with this code ?

    function custom_bar_styling() {
    	$script =<<<'EOScript'
    	    <style>
    .wp-admin-bar-ms-test-memberships {
    display:none !important;
    }
    	    </style>
    EOScript;
    	    echo $script;
    }
    add_action('admin_footer', 'custom_bar_styling');

    Insert that into either your theme's functions.php, or you can insert it as a mu-plugin.

    To create an mu-plugin, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like (making sure the file as an extension of .php, e.g. example.php) and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:

    <?php

    Thank you for being a WPMU DEV member and have a fantastic day!

    Cheers
    Jude

  • Paul
    • The Crimson Coder

    Nope, no such luck.

    But thank you very much for taking the time to try and help me with this.

    I think I will need to remove Membership2 Pro and try something else. Courseware kills my site, so there's that.

    But thank you again.

    Kindly,

    Paul

  • Michael Bissett
    • Recruit

    Hey Paul, Michael here! :slight_smile:

    You're welcome, sorry to hear that things didn't work out, though.

    In looking at the code, I did notice that I was able to get it to work with a little tweak, the . needed to be changed to a #, as we're targeting a CSS ID:

    function custom_bar_styling() {
    	$script =<<<'EOScript'
    	    <style>
    #wp-admin-bar-ms-test-memberships {
    display:none !important;
    }
    	    </style>
    EOScript;
    	    echo $script;
    }
    add_action('admin_footer', 'custom_bar_styling');

    Should you use Membership 2 Pro in another project of yours, though, you'd be welcome to try using this code. :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.