WordPress function remove_menu_page() throws an error

Posted by Rohit Kumar | Updated on

WordPress function remove_menu_page() throws an error You’re calling mf_remove_menu_pages() before $menu is actually set up, or it seems in cases when $menu is never set up. You need to wait for the admin_menu hook in order to actually call remove_menu_page(). If you’re doing it on admin_init, then you’re using the wrong hook, and that’s why it’s borking on AJAX requests.

Hope this helps!


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers