Make WordPress Core

Ticket #46072: 46072.diff

File 46072.diff, 1.7 KB (added by pbiron, 6 years ago)

proof-of-concept patch for adding $metas param to wpmu_create_blog().

  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 620e9c9194..6e0aaf30e7 100644
    a b function wpmu_create_user( $user_name, $password, $email ) { 
    12801280 * root domain (eg 'blog1.example.com'), and $path is '/'.
    12811281 *
    12821282 * @since MU (3.0.0)
     1283 * @since 5.2.0
    12831284 *
    12841285 * @param string $domain     The new site's domain.
    12851286 * @param string $path       The new site's path.
    function wpmu_create_user( $user_name, $password, $email ) { 
    12911292 *                           updated. Otherwise, keys and values will be used to set options for
    12921293 *                           the new site. Default empty array.
    12931294 * @param int    $network_id Optional. Network ID. Only relevant on multi-network installations.
     1295 * @param array  $metas      Optional. Array of key=>value pairs used to set intial blogmeta.
     1296 *                           Default: empty array.
    12941297 * @return int|WP_Error Returns WP_Error object on failure, the new site ID on success.
    12951298 */
    1296 function wpmu_create_blog( $domain, $path, $title, $user_id, $options = array(), $network_id = 1 ) {
     1299function wpmu_create_blog( $domain, $path, $title, $user_id, $options = array(), $network_id = 1, $metas = array() ) {
    12971300        $defaults = array(
    12981301                'public' => 0,
    12991302        );
    function wpmu_create_blog( $domain, $path, $title, $user_id, $options = array(), 
    13271330                'title'   => $title,
    13281331                'user_id' => $user_id,
    13291332                'options' => array_diff_key( $options, array_flip( $site_data_whitelist ) ),
     1333                'meta'    => $metas,
    13301334        );
    13311335
    13321336        $blog_id = wp_insert_site( array_merge( $site_data, $site_initialization_data ) );