is_category

Definition:
function is_category( $category = '' ) {}

Is the query for a category archive page?
If the $category parameter is specified, this function will additionally check if the query is for one of the categories specified.

Parameters

  • mixed $category: Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.

Source code

	function is_category( $category = '' ) {

		if ( !$this->is_category )

			return false;



		if ( empty($category) )

			return true;



		$cat_obj = $this->get_queried_object();



		$category = (array) $category;



		if ( in_array( $cat_obj->term_id, $category ) )

			return true;

		elseif ( in_array( $cat_obj->name, $category ) )

			return true;

		elseif ( in_array( $cat_obj->slug, $category ) )

			return true;



		return false;

	}

2099

is_blog_user

Definition:
function is_blog_user( $blog_id = 0 ) {}

Parameters

  • $blog_id

Source code

function is_blog_user( $blog_id = 0 ) {

	global $wpdb;

 

	$current_user = wp_get_current_user();

	if ( !$blog_id )

		$blog_id = $wpdb->blogid;



	$cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';



	if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )

		return true;



	return false;

}

2097

is_blog_installed

Definition:
function is_blog_installed() {}

Test whether blog is already installed.
The cache will be checked first. If you have a cache plugin, which saves the cache values, then this will work. If you use the default WordPress cache, and the database goes away, then you might have problems.

Return values

returns:Whether blog is already installed.

Source code

function is_blog_installed() {

	global $wpdb;



	// Check cache first. If options table goes away and we have true cached, oh well.

	if ( wp_cache_get( 'is_blog_installed' ) )

		return true;



	$suppress = $wpdb->suppress_errors();

	if ( ! defined( 'WP_INSTALLING' ) ) {

		$alloptions = wp_load_alloptions();

	}

	// If siteurl is not set to autoload, check it specifically

	if ( !isset( $alloptions['siteurl'] ) )

		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );

	else

		$installed = $alloptions['siteurl'];

	$wpdb->suppress_errors( $suppress );



	$installed = !empty( $installed );

	wp_cache_set( 'is_blog_installed', $installed );



	if ( $installed )

		return true;



	// If visiting repair.php, return true and let it take over.

	if ( defined( 'WP_REPAIRING' ) )

		return true;



	$suppress = $wpdb->suppress_errors();



	// Loop over the WP tables.  If none exist, then scratch install is allowed.

	// If one or more exist, suggest table repair since we got here because the options

	// table could not be accessed.

	$wp_tables = $wpdb->tables();

	foreach ( $wp_tables as $table ) {

		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.

		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )

			continue;

		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )

			continue;



		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )

			continue;



		// One or more tables exist. We are insane.



		// Die with a DB error.

		$wpdb->error = sprintf( /*WP_I18N_NO_TABLES*/'One or more database tables are unavailable.  The database may need to be <a href="%s">repaired</a>.'/*/WP_I18N_NO_TABLES*/, 'maint/repair.php?referrer=is_blog_installed' );

		dead_db();

	}



	$wpdb->suppress_errors( $suppress );



	wp_cache_set( 'is_blog_installed', false );



	return false;

}

2095

is_author

Definition:
function is_author( $author = '' ) {}

Is the query for an author archive page?
If the $author parameter is specified, this function will additionally check if the query is for one of the authors specified.

Parameters

  • mixed $author: Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames

Source code

	function is_author( $author = '' ) {

		if ( !$this->is_author )

			return false;



		if ( empty($author) )

			return true;



		$author_obj = $this->get_queried_object();



		$author = (array) $author;



		if ( in_array( $author_obj->ID, $author ) )

			return true;

		elseif ( in_array( $author_obj->nickname, $author ) )

			return true;

		elseif ( in_array( $author_obj->user_nicename, $author ) )

			return true;



		return false;

	}

2093

is_attachment

Definition:
function is_attachment() {}

Is the query for an attachment page?

Source code

	function is_attachment() {

		return (bool) $this->is_attachment;

	}

2091