Make WordPress Core

Opened 4 months ago

Closed 4 months ago

#65238 closed defect (bug) (duplicate)

Negative post id get_post is always false

Reported by: programmin Owned by:
Priority: normal Milestone:
Component: General Version: 6.9.4
Severity: normal Keywords:
Cc: Focuses:

Description

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.

Change History (1)

#1 @westonruter
4 months ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

I think this is already being requested in #64362.

Note: See TracTickets for help on using tickets.