In my functions.php I have the following:

add_theme_support( 'post-thumbnails', 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );

…which in WP 3.8.1 disables e.g. featured image (i.e. post-thumbnails).

My question is how to properly format all these support items in the add_theme_support function; is adding two separate function calls right or 'wrong'?

add_theme_support( 'post-thumbnails' ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );

3 Answers 3


You need to use one add_theme_support() call for each feature. Per the Codex, the proper function call is:

add_theme_support( $feature, $arguments );
  • Lol, I'm posting from my phone so I can't get updates until I manually refresh. See you posted an answer just before I did. You should get the credit here Apr 8, 2014 at 12:55

add_theme_support( $feature, $arguments ); as you can see have two parameters, $feature and $arguments. $feature is the feaure you need to add theme support for. This parameter doesn't accept an array, only a string.

So you would have to add a add_theme_support for every feauture that you would like to include in your theme. In your question, it is correct to use and the correct way to use two separate instances of add_theme_support.

A point of note, I always use add add_theme_support inside my theme setup function and then add that function to the after_setup_theme action hook.

  • Great response, Pieter and Chip. Chip gets the cred and a bonus hat off to your note on after_setup_theme action hook, Pieter.
    – Henrik
    Apr 8, 2014 at 13:00

If you check the source ...

1361  /**
1362   * Allows a theme to register its support of a certain feature
1363   *
1364   * Must be called in the theme's functions.php file to work.
1365   * If attached to a hook, it must be after_setup_theme.
1366   * The init hook may be too late for some features.
1367   *
1368   * @since 2.9.0
1369   * @param string $feature the feature being added
1370   */
1371  function add_theme_support( $feature ) {
1372          global $_wp_theme_features;
1374          if ( func_num_args() == 1 )
1375                  $args = true;
1376          else
1377                  $args = array_slice( func_get_args(), 1 );
1379          switch ( $feature ) {


... it is clear that add_theme_support() accepts a string, and only a string, for the $feature parameter. It doesn't check for, nor loop over, an array of values, so you must call this function each time you need it.

You could of course create your own loop to ease the pain, which is what I'd do:

$tsup = array(
  'post-thumbnails' => false,
  'html5' => array( 'comment-list', 'comment-form', 'search-form' )
foreach ($tsup as $k => $v) {

Note: That code is not thoroughly tested but throws no Notices when I run it and reading the source makes me think it should work without issue.

That func_num_args() part on lines 1354 to 1377, by the way, is how you can have two arguments as per the Codex but only one in the function definition. For example (for the curious):

function test_params($a) {
  if ( func_num_args() == 1 )
    $args = true;
    $args = array_slice( func_get_args(), 1 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.