Make WordPress Core

Ticket #49628: 49628.6.diff

File 49628.6.diff, 709 bytes (added by hellofromTonya, 3 years ago)

Simplifies the strict boolean type check to conserve memory and processing. Follow-up to [52024].

  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 91edacf76f..9be02cd010 100644
    a b function is_post_type_viewable( $post_type ) { 
    21132113         * @param bool         $is_viewable Whether the post type is "viewable".
    21142114         * @param WP_Post_Type $post_type   Post type object.
    21152115         */
    2116         $is_viewable = apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    2117 
    2118         // Make sure the filtered value is a boolean type before returning it.
    2119         if ( ! is_bool( $is_viewable ) ) {
    2120                 return false;
    2121         }
    2122 
    2123         return $is_viewable;
     2116        return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    21242117}
    21252118
    21262119/**