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;
1373
1374 if ( func_num_args() == 1 )
1375 $args = true;
1376 else
1377 $args = array_slice( func_get_args(), 1 );
1378
1379 switch ( $feature ) {
https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/theme.php#L1361
... 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) {
add_theme_support($k,$v);
}
Note: That code is not thoroughly tested but throws no Notice
s 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;
else
$args = array_slice( func_get_args(), 1 );
var_dump($args);
}
test_params('test','Oh','I','have','been','to','Ludlow','Fair');