Child Theme functions.php was not running any functions
-
I created a child theme of twentysixteen and was trying to add a nav_menu using
function register_menus() { register_nav_menu('landing', __('Landing Menu')); } add_action('init', 'register_menus');
I tried a lot of solutions on the internet (increasing the priority, overriding the parent function, removing parent function from the hook), nothing worked, it was not being shown in the Admin Panel – Appearance > Menus > Manage Locations.
Lastly, I unknowingly removed the
Template : twentysixteen
line from style.css header and re-added it. This fixed my problem.But why? What is the reason behind this behavior.
N.B. I had a function to enqueue the parent style below it, like this
function enqueue_parent_styles() { wp_enqueue_style('parent-style', get_template_directory_uri().'/style.css'); } add_action('wp_enqueue_scripts', 'enqueue_parent_styles');
It was working correctly but not the register_menus() function.
- The topic ‘Child Theme functions.php was not running any functions’ is closed to new replies.