WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#12023 closed defect (bug) (fixed)

switch_to_blog does not check if the blog really exists

Reported by: wpmuguru Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Multisite Keywords:
Focuses: Cc:

Description

MU Trac Ticket: http://trac.mu.wordpress.org/ticket/1162

switch_to_blog function imo should check if the blog specified exists or not, if not return FALSE instead of TRUE.

Change History (3)

#1 @wpmuguru
10 years ago

(In [13047]) add option to validate on switch_to_blog, see #12023

#2 @wpmuguru
10 years ago

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

To check if the blog really exists when using switch_to_blog in a plugin, add a second parameter true

$exists = switch_to_blog($blog_id, true);

#3 @nacin
10 years ago

  • Milestone changed from Unassigned to 3.0
Note: See TracTickets for help on using tickets.