WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#38175 closed enhancement (fixed)

Use `get_sites()` instead of a database lookup in `get_id_from_blogname()`

Reported by: jeremyfelt Owned by: jeremyfelt
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description

This was originally introduced in a patch on #34450, but deserved its own ticket due to the scope of changes.

Now that get_sites() is available (4.6.0) and via WP_Site_Query (4.6.0) caches queries, we can use this to handle the slug lookup instead of the manual database query.

Attachments (1)

38175.diff (4.0 KB) - added by jeremyfelt 4 years ago.

Download all attachments as: .zip

Change History (4)

@jeremyfelt
4 years ago

#1 @jeremyfelt
4 years ago

  • Owner set to jeremyfelt
  • Status changed from new to accepted

38175.diff is a carry over of @flixos90's changes from #34450. It also removes tests for the get_id_from_blogname cache key, specifically one from #20950. The functionality of get_id_from_blogname() is now covered in the tests added via #34450.

#2 @jeremyfelt
4 years ago

  • Keywords has-patch added

#3 @jeremyfelt
4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 38659:

Multisite: Use get_sites() instead of a database lookup in get_id_from_blogname().

Because queries generated via get_sites() are cached, we can remove the get_id_from_blogname cache key.

Props flixos90.
Fixes #38175.

Note: See TracTickets for help on using tickets.