[wp-trac] [WordPress Trac] #33519: Additional choices for 'fields' parameter

WordPress Trac noreply at wordpress.org
Sun Aug 23 19:35:42 UTC 2015

#33519: Additional choices for 'fields' parameter
 Reporter:  flixos90     |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:  duplicate
 Keywords:  needs-patch  |     Focuses:
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Awaiting Review =>


 This ticket is pretty much a duplicate (albeit more specific) of #19866,
 which was marked wontfix after some discussion. In a nutshell, additional
 `fields` parameters that modify the `SELECT` clause of the SQL query wreak
 havoc with persistent caches: either (a) they bypass the cache altogether,
 or (b) they require separate cache buckets, which takes up space and makes
 invalidation more complicated. See
 https://core.trac.wordpress.org/ticket/19866#comment:6 and the follow-up

 flixos90, is there any reason why the following doesn't work for your

 $posts = get_posts( array( ... ) );
 foreach ( $posts as $post ) {
     $options .= '<option value="' . esc_attr( $post->ID ) . '">' .
 esc_html( $post->post_title ) . '</option>';

 Is your concern about performance?

Ticket URL: <https://core.trac.wordpress.org/ticket/33519#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list