[wp-trac] [WordPress Trac] #52055: Allow modifying gallery_shortcode attributes before filtering the default HTML output.

WordPress Trac noreply at wordpress.org
Mon Aug 25 16:02:29 UTC 2025


#52055: Allow modifying gallery_shortcode attributes before filtering the default
HTML output.
-------------------------+------------------------------
 Reporter:  webbistro    |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:  2.5
 Severity:  normal       |  Resolution:  worksforme
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by mindctrl):

 * keywords:  has-patch dev-feedback close =>
 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Today it's possible to filter the gallery shortcode attributes via the
 `shortcode_atts_gallery` filter. Example:

 {{{
 add_filter( 'shortcode_atts_gallery', function( $out, $pairs, $atts,
 $shortcode ) {
     $out['include'] = '27'; // change IDs provided in shortcode
     return $out;
 }, 10, 4 );
 }}}

 Source: https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-
 includes/shortcodes.php#L676-L690

 Also as Callum noted, shortcodes are on the list of components being
 proposed for a form of "maintenance mode", where no new features are
 added. Source: https://make.wordpress.org/core/2025/07/02/proposal-
 introduce-maintenance-mode-for-components/

 I'm going to close this ticket to help clean up Trac, but feel free to
 reopen if you think otherwise.

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


More information about the wp-trac mailing list