WordPress.org

Make WordPress Core

Ticket #26877: get_post_for_custom_post_classes.diff

File get_post_for_custom_post_classes.diff, 946 bytes (added by MikeSchinkel, 8 years ago)

Patch to allow get_post() to check for is_custom property

  • www/wp-includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    389389        if ( empty( $post ) && isset( $GLOBALS['post'] ) )
    390390                $post = $GLOBALS['post'];
    391391
    392         if ( is_a( $post, 'WP_Post' ) ) {
     392        if ( is_a( $post, 'WP_Post' ) || ( isset( $post->is_custom ) && $post->is_custom ) ) {
    393393                $_post = $post;
    394394        } elseif ( is_object( $post ) ) {
    395395                if ( empty( $post->filter ) ) {
     
    599599         * @var string
    600600         */
    601601        public $filter;
     602
     603  /**
     604         * Allows get_post() to bypass the is_a( $post, 'WP_Post' ) check
     605         *
     606         * Does not correspond to a DB field.
     607         *
     608         * @var bool
     609         */
     610        public $is_custom = false;
    602611
    603612        public static function get_instance( $post_id ) {
    604613                global $wpdb;