1

I am using a plugin which creates both a custom post type for all my "posts" data and also another plugin which entirely handles the commenting system. Therefore I would like to entirely hide the comments and posts section from the site.

I currently have the following function:

function remove_admin_menus() {
        remove_menu_page( 'edit-comments.php' );
        remove_menu_page( 'edit.php' );
    }

However this doesn't seem to do anything. Do I need to call this function anywhere to make it actually remove the menu items?

1 Answer 1

2

You need to "hook" it to an action, in this case admin_menu:

add_action( 'admin_menu', 'remove_admin_menus' );

Just place it right after the function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.