Thanks to visit codestin.com
Credit goes to core.trac.wordpress.org

Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#65238 closed defect (bug) (duplicate)

Negative post id get_post is always false

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

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
6 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I think this is already being requested in #64362.

Note: See TracTickets for help on using tickets.