What exactly does add_theme_support do?

[ad_1]

The docs are a bit vague. This is all they say: Registers theme support for a given feature.

I had assumed that this meant, for example, your site won’t support Featured Images unless you add ‘post-thumbnail’ support. I usually always enable it on all my websites. But I’m playing around with Codeception/wp-browser and I figured I should write a test for all my functions, so I wrote a test where the test programatically uploads a file and uses set\_post\_thumbnail to a post without first adding ‘post-thumbnail’ support, expecting the test to fail. But instead, it worked.

Does this mean add\_theme\_support is only adding these capabilities to the GUI? And you can set a Featured Image for a post regardless of if you added theme support for post-thumbnails? Also, how would I write a good unit test for add\_theme\_support?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer