WordPress.org

Make WordPress Core

Changeset 45059


Ignore:
Timestamp:
03/28/2019 09:12:20 PM (20 months ago)
Author:
johnbillion
Message:

Themes: Introduce a generic action that's fired when a template part is loaded.

This action allows debugging mechanisms to perform greater introspection into which template parts are loaded for any given request. It also exposes the array of candidate template part file names for each template part instance.

Props pcfreak30, jdeeburke

Fixes #41575

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r45042 r45059  
    154154
    155155    $templates[] = "{$slug}.php";
     156
     157    /**
     158     * Fires before a template part is loaded.
     159     *
     160     * @since 5.2.0
     161     *
     162     * @param string   $slug      The slug name for the generic template.
     163     * @param string   $name      The name of the specialized template.
     164     * @param string[] $templates Array of template files to search for, in order.
     165     */
     166    do_action( 'get_template_part', $slug, $name, $templates );
    156167
    157168    locate_template( $templates, true, false );
Note: See TracChangeset for help on using the changeset viewer.