Make WordPress Core


Ignore:
Timestamp:
09/12/2025 09:16:41 PM (12 months ago)
Author:
westonruter
Message:

Posts, Post Types: Fix placement of WP_Error check in get_adjacent_post().

Props kitchin, mindctrl, westonruter, SirLouen, SergeyBiryukov, pmbaldha.
Fixes #63920.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r60697 r60733  
    18891889                        }
    18901890                        $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
     1891                        if ( is_wp_error( $term_array ) ) {
     1892                                return '';
     1893                        }
    18911894
    18921895                        // Remove any exclusions from the term array to include.
    18931896                        $term_array = array_diff( $term_array, (array) $excluded_terms );
    1894                         $term_array = array_map( 'intval', $term_array );
    1895 
    1896                         if ( ! $term_array || is_wp_error( $term_array ) ) {
     1897
     1898                        if ( ! $term_array ) {
    18971899                                return '';
    18981900                        }
     1901
     1902                        $term_array = array_map( 'intval', $term_array );
    18991903
    19001904                        $where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')';
Note: See TracChangeset for help on using the changeset viewer.