WordPress.org

Make WordPress Core

Ticket #36654: 36654.patch

File 36654.patch, 877 bytes (added by sebastian.pisula, 4 years ago)
  • wp-includes/category-template.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    13381338
    13391339        return $r;
    13401340}
     1341
     1342/**
     1343 * Check if the current post has any of given terms of taxonomy.
     1344 *
     1345 * @since 4.6.0
     1346 *
     1347 * @param string $taxonomy Taxonomy name.
     1348 * @param int|object $post_id Optional. Post to check instead of the current post.
     1349 * @return bool True if the current post has any of the given terms of taxonomy.
     1350 */
     1351function has_terms($taxonomy, $post_id = null){
     1352        $terms = get_the_terms( $post_id, $taxonomy );
     1353
     1354        return ! ( is_wp_error( $terms ) || empty( $terms ) );
     1355}