[wp-trac] [WordPress Trac] #23115: Refactor wp.media.gallery.attachments to accept an array of attachment ids rather than shortcode

WordPress Trac noreply at wordpress.org
Sun Feb 4 18:16:19 UTC 2024


#23115: Refactor wp.media.gallery.attachments to accept an array of attachment ids
rather than shortcode
-------------------------+----------------------
 Reporter:  nd987        |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Media        |     Version:
 Severity:  normal       |  Resolution:  invalid
 Keywords:               |     Focuses:
-------------------------+----------------------

Comment (by arikorhonen):

 Hello,

 You need explode to convert string to array.

 $options=array(
 'posts_per_page' => 3,
 'category_name' => $category,
 'post__in' => explode(",", $ids);
 );

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


More information about the wp-trac mailing list