[wp-trac] [WordPress Trac] #55638: Undefined property: WP_Post_Type::$post_type
WordPress Trac
noreply at wordpress.org
Sun May 1 03:13:55 UTC 2022
#55638: Undefined property: WP_Post_Type::$post_type
-------------------------------+------------------------------
Reporter: pienoz | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.9.3
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Changes (by costdev):
* keywords: => reporter-feedback
Comment:
[https://core.trac.wordpress.org/browser/tags/5.9/src/wp-includes/post-
template.php#L649 The line referenced] (649) points to:
{{{#!php
646 if ( is_singular() ) {
647 $post_id = $wp_query->get_queried_object_id();
648 $post = $wp_query->get_queried_object();
649 $post_type = $post->post_type;
}}}
So:
- [https://developer.wordpress.org/reference/functions/is_singular/
is_singular()] is returning `true`.
- [https://developer.wordpress.org/reference/functions/get_queried_object/
get_queried_object()] is returning a `WP_Post_Type` object.
- [https://developer.wordpress.org/reference/classes/wp_post_type/
WP_Post_Type] doesn't have a `post_type` property.
As Juliette said, we need more information including the backtrace and
reproduction steps.
@pienoz please provide this so that we can investigate this issue further,
or let us know if you have determined that the issue is not caused by
WordPress Core.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55638#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list