I figured this would have been a question already, but I haven't come across it.
I'm wondering what the correct hook for checking theme support is in a theme and also a plugin.
function my_theme_or_plugin_add_theme_support_feature()
if (current_theme_supports( $feature )) {
add_action( $hook, $function_to_add, $priority, $accepted_args );
add_filter( $tag, $function_to_add, $priority, $accepted_args );
}
}
add_action( $hook, 'my_theme_or_plugin_add_theme_support_feature');
So in the above example when/where should the my_theme_or_plugin_add_theme_support_feature
check, run in themes and plugins and is it necessary? Is it the same for both?
Examples:
add_action( 'wp_loaded', 'my_theme_or_plugin_add_theme_support_feature');
add_action( 'init', 'my_theme_or_plugin_add_theme_support_feature');
add_action( 'after_setup_theme', 'my_theme_or_plugin_add_theme_support_feature');
Update:
Actually I just found this question, which is very similar.
Also, here's a similar question I asked here which I was able to figure out using add_theme_support
in a plugin... however, it doesn't work 100% of the time.