I want to create a child theme (of Twentysixteen in this example) and load my stylesheet with a cache busting string. So I did the following:
function my_theme_enqueue_styles() {
$stylesheet_version = filemtime(get_stylesheet_directory() . '/style.css');
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style'), $stylesheet_version );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
This works, but as the parent theme also loads my child theme stylesheet, it gets loaded twice. I want to get rid of that second call to the same stylesheet, like so:
function remove_repeated_style(){
wp_dequeue_style('twentysixteen-style');
}
My question is: where can I hook this function to make it run after the parent theme functions have run? I have tried: 'after_setup_theme', 'wp_print_styles' and 'wp_enqueue_scripts' with a very late priority (which seems to have worked for some people, but not for me).