We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe4046b commit e91a6e5Copy full SHA for e91a6e5
src/Site_Command.php
@@ -483,19 +483,14 @@ public function get( $args, $assoc_args ) {
483
$path .= '/';
484
}
485
486
- // Query the database for the site
487
- global $wpdb;
488
- $site = $wpdb->get_row(
489
- $wpdb->prepare(
490
- "SELECT * FROM {$wpdb->blogs} WHERE domain = %s AND path = %s",
491
- $domain,
492
- $path
493
- )
494
- );
+ // Use WordPress's cached function to get the blog ID
+ $blog_id = get_blog_id_from_url( $domain, $path );
495
496
- if ( ! $site ) {
+ if ( ! $blog_id ) {
497
WP_CLI::error( "Could not find site with URL: {$site_arg}" );
498
+
+ $site = $this->fetcher->get_check( $blog_id );
499
} else {
500
// Treat as site ID
501
$site = $this->fetcher->get_check( $site_arg );
0 commit comments