Reputation: 2710
I want to create a child theme and sanitize the menu. The steps I followed are:
According to the documentation (https://codex.wordpress.org/Function_Reference/remove_menu_page) that should work:
<?php
if(!function_exists('twentyfourteen_child_setup')){
function twentyfourteen_child_setup() {
remove_menu_page( 'edit.php' ); //Posts
remove_menu_page( 'upload.php' ); //Media
remove_menu_page( 'edit.php?post_type=page' ); //Pages
remove_menu_page( 'edit-comments.php' ); //Comments
remove_menu_page( 'tools.php' ); //Tools
remove_menu_page( 'themes.php' ); //Appearance
remove_menu_page( 'plugins.php' ); //Plugins
}
}
add_action( 'admin_menu', 'twentyfourteen_child_setup');
?>
but it doesn't. My admin menu still show all the items.
Any ideas why? Am I doing anything wrong?
I added few print_r statements but none of them are logging anything. It looks like functions.php might be not read by the system?
Upvotes: 0
Views: 130
Reputation: 2710
My problem was invalid file structure of the files. My style.css was in the css folder.
theme/Css/style.css while functions.php was in the theme folder.
Once I moved style.css to the root folder of theme everything started working fine... Wow. It took me around 10h to fight with it.
Upvotes: 1