[wp-trac] [WordPress Trac] #65238: Negative post id get_post is always false

WordPress Trac noreply at wordpress.org
Wed May 13 22:12:22 UTC 2026


#65238: Negative post id get_post is always false
--------------------------+-----------------------------
 Reporter:  programmin    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.9.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Since https://github.com/WordPress/wordpress-
 develop/commit/450524a5a7a0708875f82ee5e75bb90c04049dbe, (WordPress 6.9?)
 there is no way to put in references to negative id post. This was used on
 numerous sites to show posts in the usual way on frontend and queries,
 without having to create actual posts in the WP database (queries to other
 systems for example.)

 Since WP_Post is a final class, there doesn't seem to be a way to patch
 this to not return false out of WP_Post::get_instance(). And there isn't a
 way to set transient external data on a search or result page with

 wp_cache_set($nonPostId, new WP_Post($post), 'posts');

 as in every version of WordPress before.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65238>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list