wppaste
WordPress

get_theme_feature_list( bool $api = true ): array

Since
3.1.0, 3.2.0, 3.5.0, 3.8.0, 3.8.0, 3.8.0, 3.9.0, 4.6.0, 4.6.0, 4.6.0, 4.6.0, 4.9.0, 4.9.0, 5.5.0, 5.5.0, 5.8.1, 6.1.1, 6.2.0
Source
wp-admin/includes/theme.php:314
Retrieves list of WordPress theme features (aka theme tags).

Compatibility

WordPress
since 6.2.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$apibooloptional
Whether try to fetch tags from the WordPress.org API. Defaults to true.Default: true

Return value

array
Array of features keyed by category with translations keyed by slug.

Performance profile

How much work a call to get_theme_feature_list() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Expensive

Reaches an outbound HTTP request via wp_remote_get().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
156–208

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 230.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
3

3 places in core call this, so the cost is paid more often than your own code shows.

What it touches

  • transienttransientget_site_transient()called directly
  • hookthird-party callbacksapply_filters()one call below get_theme_feature_list()
  • cacheobject cachewp_cache_get()one call below get_theme_feature_list()
  • optionnetwork optionget_site_option()one call below get_theme_feature_list()
  • httpoutbound HTTP requestwp_remote_get()one call below get_theme_feature_list()

Further down the call graph this can also reach query and serialize. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 6 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost get_theme_feature_list() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always156__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __()
!current_user_can()160__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), current_user_can()
current_user_can()182–183__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), current_user_can(), get_site_transient(), set_site_transient(), themes_api(), is_wp_error()
current_user_can()189–190__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), current_user_can(), get_site_transient(), set_site_transient(), __(), __(), __()
current_user_can()197–198__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), current_user_can(), get_site_transient(), set_site_transient(), set_site_transient(), __(), __(), __()
current_user_can() && !is_wp_error()207–208__(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), current_user_can(), get_site_transient(), set_site_transient(), themes_api(), is_wp_error(), set_site_transient(), __(), __(), __()

Across PHP versions

Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 230 instructions, 156–208 executed per call, 12 branches. The work does not change between versions.

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 6

Used by · 3

Source code

function get_theme_feature_list( $api = true ) {	// Hard-coded list is used if API is not accessible.	$features = array( 		__( 'Subject' )  => array(			'blog'           => __( 'Blog' ),			'e-commerce'     => __( 'E-Commerce' ),			'education'      => __( 'Education' ),			'entertainment'  => __( 'Entertainment' ),			'food-and-drink' => __( 'Food & Drink' ),			'holiday'        => __( 'Holiday' ),			'news'           => __( 'News' ),			'photography'    => __( 'Photography' ),			'portfolio'      => __( 'Portfolio' ),		), 		__( 'Features' ) => array(			'accessibility-ready'   => __( 'Accessibility Ready' ),			'block-patterns'        => __( 'Block Editor Patterns' ),			'block-styles'          => __( 'Block Editor Styles' ),			'custom-background'     => __( 'Custom Background' ),			'custom-colors'         => __( 'Custom Colors' ),			'custom-header'         => __( 'Custom Header' ),			'custom-logo'           => __( 'Custom Logo' ),			'editor-style'          => __( 'Editor Style' ),			'featured-image-header' => __( 'Featured Image Header' ),			'featured-images'       => __( 'Featured Images' ),			'footer-widgets'        => __( 'Footer Widgets' ),			'full-site-editing'     => __( 'Site Editor' ),			'full-width-template'   => __( 'Full Width Template' ),			'post-formats'          => __( 'Post Formats' ),			'sticky-post'           => __( 'Sticky Post' ),			'style-variations'      => __( 'Style Variations' ),			'template-editing'      => __( 'Template Editing' ),			'theme-options'         => __( 'Theme Options' ),		), 		__( 'Layout' )   => array(			'grid-layout'   => __( 'Grid Layout' ),			'one-column'    => __( 'One Column' ),			'two-columns'   => __( 'Two Columns' ),			'three-columns' => __( 'Three Columns' ),			'four-columns'  => __( 'Four Columns' ),			'left-sidebar'  => __( 'Left Sidebar' ),			'right-sidebar' => __( 'Right Sidebar' ),			'wide-blocks'   => __( 'Wide Blocks' ),		), 	); 	if ( ! $api || ! current_user_can( 'install_themes' ) ) {		return $features;	} 	$feature_list = get_site_transient( 'wporg_theme_feature_list' );	if ( ! $feature_list ) {		set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );	} 	if ( ! $feature_list ) {		$feature_list = themes_api( 'feature_list', array() );		if ( is_wp_error( $feature_list ) ) {			return $features;		}	} 	if ( ! $feature_list ) {		return $features;	} 	set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); 	$category_translations = array(		'Layout'   => __( 'Layout' ),		'Features' => __( 'Features' ),		'Subject'  => __( 'Subject' ),	); 	$wporg_features = array();

Changelog

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.2.0
Added 'Style Variations' feature.from the docblock
6.1.1
Replaced 'Full Site Editing' feature name with 'Site Editor'.from the docblock
5.8.1
Added 'Template Editing' feature.from the docblock
5.5.0
Added 'Wide Blocks' layout option.from the docblock
5.5.0
Added 'Block Editor Patterns', 'Block Editor Styles', and 'Full Site Editing' features.from the docblock
4.9.0
Removed 'BuddyPress', 'Custom Menu', 'Flexible Header', 'Front Page Posting', 'Microformats', 'RTL Language Support', 'Threaded Comments', and 'Translation Ready' features.from the docblock
4.9.0
Reordered the filters from 'Layout', 'Features', 'Subject' to 'Subject', 'Features', 'Layout'.from the docblock
4.6.0
Added 'Blog', 'E-Commerce', 'Education', 'Entertainment', 'Food & Drink', 'Holiday', 'News', 'Photography', and 'Portfolio' subjects.
Removed 'Photoblogging' and 'Seasonal' subjects.from the docblock
4.6.0
Added 'Custom Logo' and 'Footer Widgets' features.
Removed 'Blavatar' feature.from the docblock
4.6.0
Added 'Grid Layout' option.
Removed 'Fixed Layout', 'Fluid Layout', and 'Responsive Layout' options.from the docblock
4.6.0
Removed 'Colors' filter.from the docblock
3.9.0
Combined 'Layout' and 'Columns' filters.from the docblock
3.8.0
Added 'Accessibility Ready' feature and 'Responsive Layout' option.from the docblock
3.8.0
Renamed 'Fixed Width' and 'Flexible Width' options to 'Fixed Layout' and 'Fluid Layout'.from the docblock
3.8.0
Renamed 'Width' filter to 'Layout'.from the docblock
3.5.0
Added 'Flexible Header' feature.from the docblock
3.2.0
Added 'Gray' color and 'Featured Image Header', 'Featured Images', 'Full Width Template', and 'Post Formats' features.from the docblock
3.1.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.