I am trying to setup image sizes on theme activation using the hook after_setup_theme but it dosent seems like it is never really called. Why?
if( !function_exists('theme_image_size_setup') )
{
function theme_image_size_setup()
{
//Setting thumbnail size
update_option('thumbnail_size_w', 200);
update_option('thumbnail_size_h', 200);
update_option('thumbnail_crop', 1);
//Setting medium size
update_option('medium_size_w', 400);
update_option('medium_size_h', 9999);
//Setting large size
update_option('large_size_w', 800);
update_option('large_size_h', 9999);
}
}
add_action( 'after_setup_theme ', 'theme_image_size_setup' );
Instead I have doing a work around solution, but it dosn’t feel optimal if there is a hook:
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
theme_image_size_setup();
}
This works… but why is there no respons on the after_setup_theme hook?
Maybe the problem could be that you have additional space inside this string
'after_setup_theme '.Try it like this: