I'm reading this WordPress Theme flow chart.
I've setup a basic parent/child themes in my wordpress.
Child Theme (functions.php)
<?php
echo "child theme";
Parent Theme (functions.php)
<?php
echo "top";
function coffee_enqueue_styles() {
echo "parent theme";
}
add_action('wp_enqueue_scripts', 'coffee_enqueue_styles');
echo "bottom";
So after I activated my child theme and it loads and executes it's functions.php file and print child theme. Then WordPress checks if this theme has a parent, it executes it's functions.php file and in my case it does and prints top and bottom but for some reason it doesn't executes the add_action hook where I'm printing enqueued from parent.
This is the output I get.
Am I missing something? Please guide me. Thanks you.
UPDATE
I changed my action to init and it prints parent theme at the end of bottom. So my action hook is working fine.
Please, Can you please tell me why wp_enqueue_scripts hook is not executing or there is any order behind it?


After checking the core files. I found that in
wp-includes/default-filters.php. WordPress is bindingwp_enqueue_scriptswithwp_head.Which means
wp_enqueue_scriptshook is only going to work when thewp_headhook executes.So, I was missing wp_head function from the template.