Making WordPress.org


Ignore:
Timestamp:
04/16/2019 10:03:17 PM (6 years ago)
Author:
coreymckrill
Message:

WordCamp CLI: Use properties instead of array keys with WP_Site object

Trying to use $site['blog_id'] instead of $site->blog_id was throwing
a fatal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/miscellaneous.php

    r7470 r8645  
    4646
    4747        foreach ( $sites as $site ) {
    48             switch_to_blog( $site['blog_id'] );
     48            switch_to_blog( $site->blog_id );
    4949
    5050            $site_domain = parse_url( get_option( 'siteurl' ) );
     
    5252
    5353            // Skip sites that are above the requested maximum site ID
    54             if ( $max_site_id && $site['blog_id'] > $max_site_id ) {
     54            if ( $max_site_id && $site->blog_id > $max_site_id ) {
    5555                $results[] = array( $site_domain, 'skipped' );
     56                restore_current_blog();
    5657                continue;
    5758            }
Note: See TracChangeset for help on using the changeset viewer.