<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[48623] trunk/src/wp-includes/category-template.php: Docs: Improve documentation for various category functions.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/48623">48623</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/48623","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-07-26 17:16:32 +0000 (Sun, 26 Jul 2020)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Improve documentation for various category functions.

Props atachibana.
Fixes <a href="https://core.trac.wordpress.org/ticket/48394">#48394</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescategorytemplatephp">trunk/src/wp-includes/category-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescategorytemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/category-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/category-template.php       2020-07-26 16:05:39 UTC (rev 48622)
+++ trunk/src/wp-includes/category-template.php 2020-07-26 17:16:32 UTC (rev 48623)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -120,8 +120,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Retrieves category list for a post in either HTML list or custom format.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Generally used for quick, delimited (e.g. comma-separated) lists of categories,
+ * as part of a post entry meta.
+ *
+ * For a more powerful, list-based function, see wp_list_categories().
+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * @since 1.5.1
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see wp_list_categories()
+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $separator Optional. Separator between the categories. By default, the links are placed
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -128,7 +135,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *                          in an unordered list. An empty string will result in the default behavior.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $parents   Optional. How to display the parents.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int    $post_id   Optional. Post ID to retrieve categories.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Category list for a post.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_the_category_list( $separator = '', $parents = '', $post_id = false ) {
</span><span class="cx" style="display: block; padding: 0 10px">        global $wp_rewrite;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,8 +151,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.4.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param WP_Term[] $categories An array of the post's categories.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param int|bool  $post_id    ID of the post we're retrieving categories for. When `false`, we assume the
-        *                              current post in the loop.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param int|bool  $post_id    ID of the post we're retrieving categories for.
+        *                              When `false`, we assume the current post in the loop.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        $categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -272,8 +279,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $category Optional. Category ID. Will use global category ID by default.
- * @return string Category description, available.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $category Optional. Category ID. Defaults to the current category ID.
+ * @return string Category description, if available.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function category_description( $category = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return term_description( $category );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -667,7 +674,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Displays a tag cloud.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Outputs a list of tags in what is called a 'tag cloud', where the size of each tag
+ * is determined by how many times that particular tag has been assigned to posts.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * @since 2.3.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 2.8.0 Added the `taxonomy` argument.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @since 4.8.0 Added the `show_count` argument.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param array|string $args {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1164,11 +1175,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $before  Optional. String to use before tags.
- * @param string $sep     Optional. String to use between the tags.
- * @param string $after   Optional. String to use after tags.
- * @param int    $post_id Optional. Post ID. Defaults to the current post.
- * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $before  Optional. String to use before the tags. Default empty.
+ * @param string $sep     Optional. String to use between the tags. Default empty.
+ * @param string $after   Optional. String to use after the tags. Default empty.
+ * @param int    $post_id Optional. Post ID. Defaults to the current post ID.
+ * @return string|false|WP_Error A list of tags on success, false if there are no terms,
+ *                               WP_Error on failure.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1179,9 +1191,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $tag_list List of tags.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param string $before   String to use before tags.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param string $before   String to use before the tags.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param string $sep      String to use between the tags.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param string $after    String to use after tags.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param string $after    String to use after the tags.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param int    $post_id  Post ID.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1188,13 +1200,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieves the tags for a post.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Displays the tags for a post.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $before Optional. Before list.
- * @param string $sep Optional. Separate items using this.
- * @param string $after Optional. After list.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $before Optional. String to use before the tags. Defaults to 'Tags:'.
+ * @param string $sep    Optional. String to use between the tags. Default ', '.
+ * @param string $after  Optional. String to use after the tags. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function the_tags( $before = null, $sep = ', ', $after = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px">        if ( null === $before ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1213,8 +1225,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.8.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $tag Optional. Tag ID. Will use global tag ID by default.
- * @return string Tag description, available.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $tag Optional. Tag ID. Defaults to the current tag ID.
+ * @return string Tag description, if available.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function tag_description( $tag = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return term_description( $tag );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1226,9 +1238,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.8.0
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 4.9.2 The `$taxonomy` parameter was deprecated.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int  $term       Optional. Term ID. Will use global term ID by default.
- * @param null $deprecated Deprecated argument.
- * @return string Term description, available.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int  $term       Optional. Term ID. Defaults to the current term ID.
+ * @param null $deprecated Deprecated. Not used.
+ * @return string Term description, if available.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function term_description( $term = 0, $deprecated = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1237,7 +1249,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $term = $term->term_id;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         $description = get_term_field( 'description', $term );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         return is_wp_error( $description ) ? '' : $description;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1287,14 +1301,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Retrieves a post's terms as a list with specified format.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Terms are linked to their respective term listing pages.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int    $post_id  Post ID.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $taxonomy Taxonomy name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $before   Optional. Before list.
- * @param string $sep      Optional. Separate items using this.
- * @param string $after    Optional. After list.
- * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $before   Optional. String to use before the terms. Default empty.
+ * @param string $sep      Optional. String to use between the terms. Default empty.
+ * @param string $after    Optional. String to use after the terms. Default empty.
+ * @return string|false|WP_Error A list of terms on success, false if there are no terms,
+ *                               WP_Error on failure.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $terms = get_the_terms( $post_id, $taxonomy );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1398,15 +1415,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Displays the terms in a list.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Displays the terms for a post in a list.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int    $post_id  Post ID.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $taxonomy Taxonomy name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $before   Optional. Before list.
- * @param string $sep      Optional. Separate items using this.
- * @param string $after    Optional. After list.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $before   Optional. String to use before the terms. Default empty.
+ * @param string $sep      Optional. String to use between the terms. Default ', '.
+ * @param string $after    Optional. String to use after the terms. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @return void|false Void on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1433,11 +1450,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Checks if the current post has any of given category.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The given categories are checked against the post's categories' term_ids, names and slugs.
+ * Categories given as integers will only be checked against the post's categories' term_ids.
+ *
+ * If no categories are given, determines if post has any categories.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|int|array $category Optional. The category name/term_id/slug or array of them to check for.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|int|array $category Optional. The category name/term_id/slug,
+ *                                   or an array of them to check for. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @param int|object       $post     Optional. Post to check instead of the current post.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool True if the current post has any of the given categories (or any category, if no category specified).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool True if the current post has any of the given categories
+ *              (or any category, if no category specified). False otherwise.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function has_category( $category = '', $post = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return has_term( $category, 'category', $post );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1448,21 +1472,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * The given tags are checked against the post's tags' term_ids, names and slugs.
</span><span class="cx" style="display: block; padding: 0 10px">  * Tags given as integers will only be checked against the post's tags' term_ids.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * If no tags are given, determines if post has any tags.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prior to v2.7 of WordPress, tags given as integers would also be checked against the post's tags' names and slugs (in addition to term_ids)
- * Prior to v2.7, this function could only be used in the WordPress Loop.
- * As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
- *
</del><span class="cx" style="display: block; padding: 0 10px">  * For more information on this and similar theme functions, check out
</span><span class="cx" style="display: block; padding: 0 10px">  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
</span><span class="cx" style="display: block; padding: 0 10px">  * Conditional Tags} article in the Theme Developer Handbook.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.6.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 2.7.0 Tags given as integers are only checked against
+ *              the post's tags' term_ids, not names or slugs.
+ * @since 2.7.0 Can be used outside of the WordPress Loop if `$post` is provided.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|int|array $tag  Optional. The tag name/term_id/slug or array of them to check for.
- * @param int|object       $post Optional. Post to check instead of the current post. (since 2.7.0)
- * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|int|array $tag  Optional. The tag name/term_id/slug,
+ *                               or an array of them to check for. Default empty.
+ * @param int|object       $post Optional. Post to check instead of the current post.
+ * @return bool True if the current post has any of the given tags
+ *              (or any tag, if no tag specified). False otherwise.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function has_tag( $tag = '', $post = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return has_term( $tag, 'post_tag', $post );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1473,14 +1499,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * The given terms are checked against the post's terms' term_ids, names and slugs.
</span><span class="cx" style="display: block; padding: 0 10px">  * Terms given as integers will only be checked against the post's terms' term_ids.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px">  * If no terms are given, determines if post has any terms.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|int|array $term     Optional. The term name/term_id/slug or array of them to check for.
- * @param string           $taxonomy Taxonomy name.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|int|array $term     Optional. The term name/term_id/slug,
+ *                                   or an array of them to check for. Default empty.
+ * @param string           $taxonomy Optional. Taxonomy name. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @param int|WP_Post      $post     Optional. Post to check instead of the current post.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool True if the current post has any of the given terms
+ *              (or any term, if no term specified). False otherwise.
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function has_term( $term = '', $taxonomy = '', $post = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $post = get_post( $post );
</span></span></pre>
</div>
</div>

</body>
</html>