Using WordPress ‘register_theme_feature()’ PHP function

The register_theme_feature() WordPress PHP function registers a theme feature for use in add_theme_support().

Usage

register_theme_feature( string $feature, array $args = array() );

Parameters

  • $feature (string): The name uniquely identifying the feature. See add_theme_support() for the list of possible values.
  • $args (array): Optional extra arguments to pass along with certain features.

More information

See WordPress Developer Resources: register_theme_feature()

Examples

Register custom background support

This example registers the custom background support for a theme.

register_theme_feature( 'custom-background' );

Register custom logo support

This example registers the custom logo support for a theme.

register_theme_feature( 'custom-logo' );

Register custom header support

This example registers the custom header support for a theme.

register_theme_feature( 'custom-header' );

Register custom line-height support

This example registers the custom line-height support for a theme.

register_theme_feature( 'custom-line-height' );

Register align-wide support

This example registers the align-wide support for a theme.

register_theme_feature( 'align-wide' );