wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
restore_current_blog › WordPress Function
Desden/a
Obsoleton/a
› restore_current_blog ( Sem parâmetros )
| Ver: | |
| Retorna: |
|
| Definido em: |
|
| Codex: | |
| Log de mudanças: |
|
Restores the current blog, after calling switch_to_blog().
Funções relacionadas: restore_current_locale, get_current_blog_id, create_empty_blog, get_current_site, set_current_user
Fonte
function restore_current_blog() {
global $wpdb;
if ( empty( $GLOBALS['_wp_switched_stack'] ) ) {
return false;
}
$new_blog_id = array_pop( $GLOBALS['_wp_switched_stack'] );
$prev_blog_id = get_current_blog_id();
if ( $new_blog_id === $prev_blog_id ) {
/** This filter is documented in wp-includes/ms-blogs.php */
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );
// If we still have items in the switched stack, consider ourselves still 'switched'.
$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
return true;
}
$wpdb->set_blog_id( $new_blog_id );
$GLOBALS['blog_id'] = $new_blog_id;
$GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
wp_cache_switch_to_blog( $new_blog_id );
/** This filter is documented in wp-includes/ms-blogs.php */
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );
// If we still have items in the switched stack, consider ourselves still 'switched'.
$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
return true;
}