switch_to_blog


switch_to_blog ( $new_blog_id, $deprecated = null )

Parameters:
  • (int) new_blog_id The ID of the blog to switch to. Default: current blog.
  • (bool) deprecated Not used.
See:
Returns:
  • (true) Always returns true.
Defined at:
Change Log:
  • M: U

Description

Switches the current blog.This function is useful if you need to pull posts, or other information, from other blogs. You can switch back afterwards using restore_current_blog(). PHP code loaded with the originally requested site, such as code from a plugin or theme, does not switch. See #14941.

Related Functions

switch_to_locale, wp_cache_switch_to_blog, switch_to_user_locale, switch_theme, the_custom_logo

Top Google Results

User discussions

wpseek mobile