Make WordPress Core

Changeset 44912


Ignore:
Timestamp:
03/15/2019 07:42:40 PM (6 years ago)
Author:
desrosj
Message:

Networks and Sites: Introduce populate_site_meta filter.

The populate_site_meta filter can be used to modify the site meta added during the creation of a new site. This filter mirrors the approach used for networks in populate_network_meta.

Props spacedmonkey, davidbaumwald.
Fixes #46437.

File:
1 edited

Legend:

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

    r44683 r44912  
    13171317    }
    13181318
     1319    /**
     1320     * Filters meta for a site on creation.
     1321     *
     1322     * @since 5.2.0
     1323     *
     1324     * @param array $meta    Associative array of site meta keys and values to be inserted.
     1325     * @param int   $site_id ID of site to populate.
     1326     */
     1327    $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
     1328
    13191329    $insert = '';
    1320     foreach ( $meta as $meta_key => $meta_value ) {
     1330    foreach ( $site_meta as $meta_key => $meta_value ) {
    13211331        if ( is_array( $meta_value ) ) {
    13221332            $meta_value = serialize( $meta_value );
Note: See TracChangeset for help on using the changeset viewer.