Make WordPress Core


Ignore:
Timestamp:
02/24/2026 10:42:27 PM (9 months ago)
Author:
SergeyBiryukov
Message:

Code Quality: Correct return statement in WP_Query::setup_postdata().

This reflects that the method can return both true (success) and false (failure).

Follow-up to [32620], [34089], [44941].

Props huzaifaalmesbah, westonruter.
See #64238.

File:
1 edited

Legend:

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

    r61590 r61727  
    48174817         *
    48184818         * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
    4819          * @return true True when finished.
     4819         * @return bool True on success, false on failure.
    48204820         */
    48214821        public function setup_postdata( $post ) {
    … …  
    48274827
    48284828                if ( ! $post ) {
    4829                         return;
     4829                        return false;
    48304830                }
    48314831
    48324832                $elements = $this->generate_postdata( $post );
    48334833                if ( false === $elements ) {
    4834                         return;
     4834                        return false;
    48354835                }
    48364836
Note: See TracChangeset for help on using the changeset viewer.