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.
Built from https://develop.svn.wordpress.org/trunk@44912


git-svn-id: http://core.svn.wordpress.org/trunk@44743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-03-15 19:43:50 +00:00
parent f03ccf6813
commit c84bb94796
2 changed files with 12 additions and 2 deletions

View File

@ -1316,8 +1316,18 @@ function populate_site_meta( $site_id, array $meta = array() ) {
return;
}
/**
* Filters meta for a site on creation.
*
* @since 5.2.0
*
* @param array $meta Associative array of site meta keys and values to be inserted.
* @param int $site_id ID of site to populate.
*/
$site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
$insert = '';
foreach ( $meta as $meta_key => $meta_value ) {
foreach ( $site_meta as $meta_key => $meta_value ) {
if ( is_array( $meta_value ) ) {
$meta_value = serialize( $meta_value );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-alpha-44911';
$wp_version = '5.2-alpha-44912';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.