tag_description

Definition:
function tag_description( $tag = 0 ) {}

Retrieve tag description.

Parameters

  • int $tag: Optional. Tag ID. Will use global tag ID by default.

Return values

returns:Tag description, available.

Source code

function tag_description( $tag = 0 ) {

	return term_description( $tag );

}

2929

sync_category_tag_slugs

Definition:
function sync_category_tag_slugs( $term, $taxonomy ) {}

Parameters

  • $term
  • $taxonomy

Source code

function sync_category_tag_slugs( $term, $taxonomy ) {

	if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {

		if ( is_object( $term ) ) {

			$term->slug = sanitize_title( $term->name );

		} else {

			$term['slug'] = sanitize_title( $term['name'] );

		}

	}

	return $term;

}

2927

switch_to_blog

Definition:
function switch_to_blog( $new_blog, $validate = false ) {}

Switch 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().

Parameters

  • int $new_blog: The id of the blog you want to switch to. Default: current blog
  • bool $validate: Whether to check if $new_blog exists before proceeding

Return values

returns:True on success, False if the validation failed

Defined actions

  • switch_blog
    do_action( 'switch_blog', $blog_id, $blog_id );
  • switch_blog
    do_action('switch_blog', $blog_id, $prev_blog_id);

Source code

function switch_to_blog( $new_blog, $validate = false ) {

	global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;



	if ( empty($new_blog) )

		$new_blog = $blog_id;



	if ( $validate && ! get_blog_details( $new_blog ) )

		return false;



	if ( empty($switched_stack) )

		$switched_stack = array();



	$switched_stack[] = $blog_id;



	/* If we're switching to the same blog id that we're on,

	* set the right vars, do the associated actions, but skip

	* the extra unnecessary work */

	if ( $blog_id == $new_blog ) {

		do_action( 'switch_blog', $blog_id, $blog_id );

		$switched = true;

		return true;

	}



	$wpdb->set_blog_id($new_blog);

	$table_prefix = $wpdb->prefix;

	$prev_blog_id = $blog_id;

	$blog_id = $new_blog;



	if ( is_object( $wp_roles ) ) {

		$wpdb->suppress_errors();

		if ( method_exists( $wp_roles ,'_init' ) )

			$wp_roles->_init();

		elseif ( method_exists( $wp_roles, '__construct' ) )

			$wp_roles->__construct();

		$wpdb->suppress_errors( false );

	}



	if ( did_action('init') ) {

		$current_user = wp_get_current_user();

		if ( is_object( $current_user ) )

			$current_user->for_blog( $blog_id );

	}



	if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) )

		$global_groups = $wp_object_cache->global_groups;

	else

		$global_groups = false;



	wp_cache_init();

	if ( function_exists('wp_cache_add_global_groups') ) {

		if ( is_array( $global_groups ) )

			wp_cache_add_global_groups( $global_groups );

		else

			wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );

		wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));

	}



	do_action('switch_blog', $blog_id, $prev_blog_id);

	$switched = true;

	return true;

}

2925

switch_theme

Definition:
function switch_theme($template, $stylesheet) {}

Switches current theme to new template and stylesheet names.

Parameters

  • string $template: Template name
  • string $stylesheet: Stylesheet name.

Defined actions

  • switch_theme
    do_action( 'switch_theme', $theme );

Source code

function switch_theme($template, $stylesheet) {

	global $wp_theme_directories, $sidebars_widgets;



	if ( is_array( $sidebars_widgets ) )

		set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $sidebars_widgets ) );



	$old_theme = get_current_theme();



	update_option('template', $template);

	update_option('stylesheet', $stylesheet);



	if ( count($wp_theme_directories) > 1 ) {

		update_option('template_root', get_raw_theme_root($template, true));

		update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));

	}



	delete_option('current_theme');

	$theme = get_current_theme();



	if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) {

		$default_theme_mods = (array) get_option( "mods_$theme" );

		add_option( "theme_mods_$stylesheet", $default_theme_mods );

	}



	update_option( 'theme_switched', $old_theme );

	do_action( 'switch_theme', $theme );

}

2923

strip_shortcodes

Definition:
function strip_shortcodes( $content ) {}

Remove all shortcode tags from the given content.

Parameters

  • string $content: Content to remove shortcode tags.

Return values

returns:Content without shortcode tags.

Source code

function strip_shortcodes( $content ) {

	global $shortcode_tags;



	if (empty($shortcode_tags) || !is_array($shortcode_tags))

		return $content;



	$pattern = get_shortcode_regex();



	return preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );

}

2921