Hello @michaelacaggi,
This feature must be called before the ‘init’ hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the ‘after_setup_theme’ hook.
You can try ‘add_theme_support’ with ‘after_setup_theme’ hook. Might be, it will work for you.
Below is an example :-
function your_function_name() {
add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'your_function_name' );
Hope this will work for you.
Thanks,
Sahil
I pasted this code in, Sahil, into my functions.php file for my theme, except it doesn’t seem to work. Could you please check to see if I did it correctly? The code is at line 97.
https://pastebin.com/sZqCa5BU
Hello @michaelacaggi,
Thanks for sharing the code.
I have reviewed your code and you have added it correctly. But not sure why it is not working.
But, I have updated your code and added the post name in the ‘add_theme_support’ parameters.
Updated code :- https://pastebin.com/fWAp19Vc ( Line no. 41 )
Please copy this update and paste it into your function.php file.
Note :- I have added default ‘post’ & ‘page’. If you are using a CPT then add your CPT name after the ‘page’ on line no – 41.
Please add this updated code and let me know that it’s working or not.
Thanks,
Sahil
Still nothing… it also doesn’t work on my other website, and I tried multiple different themes.
Hii @michaelacaggi,
Can you please verify that you enabled the featured image option from the post settings? Please check the below screenshot for reference.
Settings screenshot :- https://prnt.sc/O1e8LgEF6tHM
If you are not able to see the featured image option there then please try to find this code ‘remove_theme_support’ in your whole theme. Might be, that you have removed the ‘post-thumbnails’ feature by using this function.
Still unable to find any solution, then deactivate all your plugins and then check. It is also possible that any other plugin is conflicting with this feature.
Thank you,
Sahil
Thank you so much, Multani for your help. It was the plugin Presto Player that was causing an issue.
Great.! Now you can ask their plugin support to fix the issue.