[wp-trac] [WordPress Trac] #41905: Only loop over enclosure meta keys in rss_enclosure() and atom_enclosure()

WordPress Trac noreply at wordpress.org
Mon Sep 18 10:26:39 UTC 2017


#41905: Only loop over enclosure meta keys in rss_enclosure() and atom_enclosure()
-------------------------+-----------------------------
 Reporter:  birgire      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Feeds        |    Version:  2.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Instead of getting all post meta keys for the current post and then filter
 out the {{{enclosure}}} keys:


 {{{
 foreach ( (array) get_post_custom() as $key => $val ) {
         if ($key == 'enclosure') {

 }}}

 we could only get the ones we need with:

 {{{
 $meta_enclosures = get_post_meta( get_the_ID(), 'enclosure', false );
 foreach ( (array) $meta_enclosures as $key => $val ){

 }}}


 where {{{get_post_custom()}}} is a wrapper for {{{get_post_meta(
 get_the_ID() )}}}.

 See {{{atom_enclosure()}}}
 [https://github.com/WordPress/WordPress/blob/bbb8d48086b7d10908f4fda673585ee122f2851d
 /wp-includes/feed.php#L463 here] and {{{rss_enclosure()}}}
 [https://github.com/WordPress/WordPress/blob/bbb8d48086b7d10908f4fda673585ee122f2851d
 /wp-includes/feed.php#L463 here].

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


More information about the wp-trac mailing list