is_plugin_active

Definition:
function is_plugin_active( $plugin ) {}

Check whether the plugin is active by checking the active_plugins list.

Parameters

  • string $plugin: Base plugin path from plugins directory.

Return values

returns:True, if in the active plugins list. False, not in the list.

Source code

function is_plugin_active( $plugin ) {

	return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );

}

2159

is_page_template

Definition:
function is_page_template($template = '') {}

Whether currently in a page template.
This template tag allows you to determine if you are in a page template. You can optionally provide a template name and then the check will be specific to that template.

Parameters

  • string $template: The specific template name if specific matching is required.

Return values

returns:False on failure, true if success.

Source code

function is_page_template($template = '') {

	if (!is_page()) {

		return false;

	}



	global $wp_query;



	$page = $wp_query->get_queried_object();

	$custom_fields = get_post_custom_values('_wp_page_template',$page->ID);

	$page_template = $custom_fields[0];



	// We have no argument passed so just see if a page_template has been specified

	if ( empty( $template ) ) {

		if ( !empty( $page_template ) and ( 'default' != $page_template ) ) {

			return true;

		}

	} elseif ( $template == $page_template) {

		return true;

	}



	return false;

}

2157

is_paged

Definition:
function is_paged() {}

Is the query for paged result and not for the first page?

Source code

	function is_paged() {

		return (bool) $this->is_paged;

	}

2155

is_page

Definition:
function is_page( $page = '' ) {}

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

Parameters

  • mixed $page: Page ID, title, slug, or array of such.

Source code

	function is_page( $page = '' ) {

		if ( !$this->is_page )

			return false;



		if ( empty( $page ) )

			return true;



		$page_obj = $this->get_queried_object();



		$page = (array) $page;



		if ( in_array( $page_obj->ID, $page ) )

			return true;

		elseif ( in_array( $page_obj->post_title, $page ) )

			return true;

		else if ( in_array( $page_obj->post_name, $page ) )

			return true;



		return false;

	}

2153

is_object_in_term

Definition:
function is_object_in_term( $object_id, $taxonomy, $terms = null ) {}

Determine if the given object is associated with any of the given terms.
The given terms are checked against the object’s terms’ term_ids, names and slugs. Terms given as integers will only be checked against the object’s terms’ term_ids. If no terms are given, determines if object is associated with any terms in the given taxonomy.

Parameters

  • int $object_id: ID of the object (post ID, link ID, …)
  • string $taxonomy: Single taxonomy name
  • int|string|array $terms: Optional. Term term_id, name, slug or array of said

Return values

returns:WP_Error on input error.

Source code

function is_object_in_term( $object_id, $taxonomy, $terms = null ) {

	if ( !$object_id = (int) $object_id )

		return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );



	$object_terms = get_object_term_cache( $object_id, $taxonomy );

	if ( empty( $object_terms ) )

		 $object_terms = wp_get_object_terms( $object_id, $taxonomy );



	if ( is_wp_error( $object_terms ) )

		return $object_terms;

	if ( empty( $object_terms ) )

		return false;

	if ( empty( $terms ) )

		return ( !empty( $object_terms ) );



	$terms = (array) $terms;



	if ( $ints = array_filter( $terms, 'is_int' ) )

		$strs = array_diff( $terms, $ints );

	else

		$strs =& $terms;



	foreach ( $object_terms as $object_term ) {

		if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id

		if ( $strs ) {

			if ( in_array( $object_term->term_id, $strs ) ) return true;

			if ( in_array( $object_term->name, $strs ) )    return true;

			if ( in_array( $object_term->slug, $strs ) )    return true;

		}

	}



	return false;

}

2151