Make WordPress Core


Ignore:
Timestamp:
08/22/2016 06:24:48 PM (10 years ago)
Author:
DrewAPicture
Message:

Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.

Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin.php

    r38015 r38307  
    210210                 * @since 2.1.0
    211211                 */
    212                 do_action( 'load-' . $page_hook );
     212                do_action( "load-{$page_hook}" );
    213213                if (! isset($_GET['noheader']))
    214214                        require_once(ABSPATH . 'wp-admin/admin-header.php');
     
    240240                 * @since 1.5.0
    241241                 */
    242                 do_action( 'load-' . $plugin_page );
     242                do_action( "load-{$plugin_page}" );
    243243
    244244                if ( !isset($_GET['noheader']))
     
    279279         * @since 3.5.0
    280280         */
    281         do_action( 'load-importer-' . $importer );
     281        do_action( "load-importer-{$importer}" );
    282282
    283283        $parent_file = 'tools.php';
     
    327327         * @since 2.1.0
    328328         */
    329         do_action( 'load-' . $pagenow );
     329        do_action( "load-{$pagenow}" );
    330330
    331331        /*
Note: See TracChangeset for help on using the changeset viewer.