[wp-trac] [WordPress Trac] #42949: wp_attachment_is() forces the page to get new instance of post

WordPress Trac noreply at wordpress.org
Thu Dec 21 23:29:45 UTC 2017


#42949: wp_attachment_is() forces the page to get new instance of post
-------------------------------------+------------------------------
 Reporter:  bowlerman235             |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Posts, Post Types        |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  reporter-feedback close  |     Focuses:  performance
-------------------------------------+------------------------------
Changes (by dd32):

 * keywords:   => reporter-feedback close


Comment:

 Hi @bowlerman235,

 `wp_attachment_is()` does make a call to `get_post()` however in the event
 that a WP_Post is passed it'll eventually get passed back. WordPress also
 includes a in-memory cache so that fetching the same post multiple times
 by the same ID will not result in more database queries.

 If you're seeing something other than the above, can you let us know
 exactly what you're seeing?

 This ticket seems `invalid`, however I'll wait for your response before
 closing it for now.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42949#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list