apply_filters( ‘default_wp_template_part_areas’, array[] $default_area_definitions )

Filters the list of allowed template part area values.

Parameters

$default_area_definitionsarray[]
The allowed template part area values.
  • ...$0 array
    Data for the template part area.
    • area string
      Template part area name.
    • label string
      Template part area label.
    • description string
      Template part area description.
    • icon string
      Template part area icon.
    • area_tag string
      Template part area tag.

Source

return apply_filters( 'default_wp_template_part_areas', $default_area_definitions );

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    How to register a sidebar template part using this hook:

    add_filter( 'default_wp_template_part_areas', 'wpdocs_template_part_areas' );
    
    function wpdocs_template_part_areas( array $areas ) {
        $areas[] = array(
            'area'        => 'sidebar',
            'area_tag'    => 'section', // Valid elements: div, header, main, section, article, aside and footer.
            'label'       => __( 'Sidebar', 'mytheme' ),
            'description' => __( 'Template part area description', 'mytheme' ),
            'icon'        => 'sidebar' // Default icons: header, footer and sidebar.
        );
    
        return $areas;
    }

You must log in before being able to contribute a note or feedback.