got_mod_rewrite

Definition:
function got_mod_rewrite() {}

Defined filters

  • got_rewrite
    apply_filters('got_rewrite', $got_rewrite)

Source code

function got_mod_rewrite() {

	$got_rewrite = apache_mod_loaded('mod_rewrite', true);

	return apply_filters('got_rewrite', $got_rewrite);

}

1919

global_terms_enabled

Definition:
function global_terms_enabled() {}

Whether global terms are enabled.

Return values

returns:True if multisite and global terms enabled

Defined filters

  • global_terms_enabled
    apply_filters( 'global_terms_enabled', null )

Source code

function global_terms_enabled() {

	if ( ! is_multisite() )

		return false;



	static $global_terms = null;

	if ( is_null( $global_terms ) ) {

		$filter = apply_filters( 'global_terms_enabled', null );

		if ( ! is_null( $filter ) )

			$global_terms = (bool) $filter;

		else

			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );

	}

	return $global_terms;

}

1917

global_terms

Definition:
function global_terms( $term_id, $deprecated = '' ) {}

Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.

Parameters

  • int $term_id: An ID for a term on the current blog.
  • $deprecated

Return values

returns:An ID from the global terms table mapped from $term_id.

Source code

function global_terms( $term_id, $deprecated = '' ) {

	global $wpdb;

	static $global_terms_recurse = null;



	if ( !global_terms_enabled() )

		return $term_id;



	// prevent a race condition

	$recurse_start = false;

	if ( $global_terms_recurse === null ) {

		$recurse_start = true;

		$global_terms_recurse = 1;

	} elseif ( 10 < $global_terms_recurse++ ) {

		return $term_id;

	}



	$term_id = intval( $term_id );

	$c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );



	$global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );

	if ( $global_id == null ) {

		$used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );

		if ( null == $used_global_id ) {

			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );

			$global_id = $wpdb->insert_id;

			if ( empty( $global_id ) )

				return $term_id;

		} else {

			$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );

			$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );

			$new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );

			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );

			$global_id = $wpdb->insert_id;

		}

	} elseif ( $global_id != $term_id ) {

		$local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );

		if ( null != $local_id )

			$local_id = global_terms( $local_id );

			if ( 10 < $global_terms_recurse )

				$global_id = $term_id;

	}



	if ( $global_id != $term_id ) {

		if ( get_option( 'default_category' ) == $term_id )

			update_option( 'default_category', $global_id );



		$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );

		$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );

		$wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );



		clean_term_cache($term_id);

	}

	if( $recurse_start )

		$global_terms_recurse = null;



	return $global_id;

}

1915

get_year_link

Definition:
function get_year_link($year) {}

Retrieve the permalink for the year archives.

Parameters

  • int|bool $year: False for current year or year for permalink.

Defined filters

  • year_link
    apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year')
  • year_link
    apply_filters('year_link', home_url('?m=' . $year)

Source code

function get_year_link($year) {

	global $wp_rewrite;

	if ( !$year )

		$year = gmdate('Y', current_time('timestamp'));

	$yearlink = $wp_rewrite->get_year_permastruct();

	if ( !empty($yearlink) ) {

		$yearlink = str_replace('%year%', $year, $yearlink);

		return apply_filters('year_link', home_url( user_trailingslashit($yearlink, 'year') ), $year);

	} else {

		return apply_filters('year_link', home_url('?m=' . $year), $year);

	}

}

1913

get_wp_title_rss

Definition:
function get_wp_title_rss($sep = '»') {}

Retrieve the blog title for the feed title.

Parameters

  • string $sep: Optional.How to separate the title. See wp_title() for more info.

Return values

returns:Error message on failure or blog title on success.

Defined filters

  • get_wp_title_rss
    apply_filters('get_wp_title_rss', $title)

Source code

function get_wp_title_rss($sep = '»') {

	$title = wp_title($sep, false);

	if ( is_wp_error( $title ) )

		return $title->get_error_message();

	$title = apply_filters('get_wp_title_rss', $title);

	return $title;

}

1911