mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Make in_category() an alias of has_category(). fixes #16718.
Built from https://develop.svn.wordpress.org/trunk@25119 git-svn-id: http://core.svn.wordpress.org/trunk@25099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ca17a6161a
commit
503f867e1d
@ -225,16 +225,14 @@ function get_the_category_list( $separator = '', $parents='', $post_id = false )
|
|||||||
* As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
|
* As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
|
* @uses has_category()
|
||||||
*
|
*
|
||||||
* @param int|string|array $category Category ID, name or slug, or array of said.
|
* @param int|string|array $category Category ID, name or slug, or array of said.
|
||||||
* @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
|
* @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
|
||||||
* @return bool True if the current post is in any of the given categories.
|
* @return bool True if the current post is in any of the given categories.
|
||||||
*/
|
*/
|
||||||
function in_category( $category, $post = null ) {
|
function in_category( $category, $post = null ) {
|
||||||
if ( empty( $category ) )
|
return has_category( $category, $post );
|
||||||
return false;
|
|
||||||
|
|
||||||
return has_term( $category, 'category', $post );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user