Make WordPress Core

Changeset 59566


Ignore:
Timestamp:
12/30/2024 09:30:14 AM (23 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in get_post_ancestors().

Follow-up to [7074], [15758], [21559], [21953].

Props aristath, poena, afercia, SergeyBiryukov.
See #62279.

File:
1 edited

Legend:

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

    r59565 r59566  
    11361136        $post = get_post( $post );
    11371137
    1138         if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) {
     1138        if ( ! $post || empty( $post->post_parent ) || $post->post_parent === $post->ID ) {
    11391139                return array();
    11401140        }
    … …  
    11471147        while ( $ancestor = get_post( $id ) ) {
    11481148                // Loop detection: If the ancestor has been seen before, break.
    1149                 if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors, true ) ) {
     1149                if ( empty( $ancestor->post_parent ) || $ancestor->post_parent === $post->ID
     1150                        || in_array( $ancestor->post_parent, $ancestors, true )
     1151                ) {
    11501152                        break;
    11511153                }
Note: See TracChangeset for help on using the changeset viewer.