has_tag

Definition:
function has_tag( $tag = '', $post = null ) {}

Check if the current post has any of given tags.
The given tags are checked against the post’s tags’ term_ids, names and slugs. Tags given as integers will only be checked against the post’s tags’ term_ids. If no tags are given, determines if post has any tags.

Parameters

  • string|int|array $tag: Optional. The tag name/term_id/slug or array of them to check for.
  • int|object $post: Optional. Post to check instead of the current post. (since 2.7.0)

Return values

returns:True if the current post has any of the given tags (or any tag, if no tag specified).

Source code

function has_tag( $tag = '', $post = null ) {

	return has_term( $tag, 'post_tag', $post );

}

1939

has_post_thumbnail

Definition:
function has_post_thumbnail( $post_id = null ) {}

Check if post has an image attached.

Parameters

  • int $post_id: Optional. Post ID.

Return values

returns:Whether post has an image attached.

Source code

function has_post_thumbnail( $post_id = null ) {

	return (bool) get_post_thumbnail_id( $post_id );

}

1937

has_nav_menu

Definition:
function has_nav_menu( $location ) {}

Whether a registered nav menu location has a menu assigned to it.

Parameters

  • string $location: Menu location identifier.

Return values

returns:Whether location has a menu.

Source code

function has_nav_menu( $location ) {

	$locations = get_nav_menu_locations();

	return ( ! empty( $locations[ $location ] ) );

}

1935

has_meta

Definition:
function has_meta( $postid ) {}

Some postmeta stuff.

Parameters

  • unknown_type $postid

Source code

function has_meta( $postid ) {

	global $wpdb;



	return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id

			FROM $wpdb->postmeta WHERE post_id = %d

			ORDER BY meta_key,meta_id", $postid), ARRAY_A );



}

1933

has_filter

Definition:
function has_filter($tag, $function_to_check = false) {}

Check if any filter has been registered for a hook.

Parameters

  • string $tag: The name of the filter hook.
  • callback $function_to_check: optional. If specified, return the priority of that function on this hook or false if not attached.

Return values

returns:Optionally returns the priority on that hook for the specified function.

Source code

function has_filter($tag, $function_to_check = false) {

	global $wp_filter;



	$has = !empty($wp_filter[$tag]);

	if ( false === $function_to_check || false == $has )

		return $has;



	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )

		return false;



	foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {

		if ( isset($wp_filter[$tag][$priority][$idx]) )

			return $priority;

	}



	return false;

}

1931