Make WordPress Core

Ticket #49628: 49628.8.diff

File 49628.8.diff, 1.2 KB (added by hellofromTonya, 3 years ago)

Improves the explanation in 49628.9.diff to be consistent with the similar change in #54375.

  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 41c0c4664c..f578e4ce35 100644
    a b function is_post_type_viewable( $post_type ) { 
    21352135        /**
    21362136         * Filters whether a post type is considered "viewable".
    21372137         *
     2138         * The returned filtered value must be a boolean type to ensure
     2139         * `is_post_type_viewable()` only returns a boolean. This strictness
     2140         * is by design to maintain backwards-compatibility and guard against
     2141         * potential type errors in PHP 8.1+. Non-boolean values (even falsey
     2142         * and truthy values) will result in the function returning false.
     2143         *
    21382144         * @since 5.9.0
    21392145         *
    2140          * @param bool         $is_viewable Whether the post type is "viewable".
     2146         * @param bool         $is_viewable Whether the post type is "viewable" (strict type).
    21412147         * @param WP_Post_Type $post_type   Post type object.
    21422148         */
    2143         $is_viewable = apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    2144 
    2145         // Make sure the filtered value is a boolean type before returning it.
    2146         if ( ! is_bool( $is_viewable ) ) {
    2147                 return false;
    2148         }
    2149 
    2150         return $is_viewable;
     2149        return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    21512150}
    21522151
    21532152/**