function current_theme_supports( $feature ) {}

Checks a theme’s support for a given feature


  • string $feature: the feature being checked

Source code

function current_theme_supports( $feature ) {

	global $_wp_theme_features;

	if ( !isset( $_wp_theme_features[$feature] ) )

		return false;

	// If no args passed then no extra checks need be performed

	if ( func_num_args() <= 1 )

		return true;

	$args = array_slice( func_get_args(), 1 );

	// @todo Allow pluggable arg checking

	switch ( $feature ) {

		case 'post-thumbnails':

			// post-thumbnails can be registered for only certain content/post types by passing

			// an array of types to add_theme_support().  If no array was passed, then

			// any type is accepted

			if ( true === $_wp_theme_features[$feature] )  // Registered for all types

				return true;

			$content_type = $args[0];

			return in_array( $content_type, $_wp_theme_features[$feature][0] );


		case 'post-formats':

			// specific post formats can be registered by passing an array of types to

			// add_theme_support()

			$post_format = $args[0];

			return in_array( $post_format, $_wp_theme_features[$feature][0] );



	return true;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: