WP_Widget_Custom_HTML::_filter_gallery_shortcode_attrs()
Filters gallery shortcode attributes.
Prevents all of a site's attachments from being shown in a gallery displayed on a non-singular template where a $post context is not available.
Method of the class: WP_Widget_Custom_HTML{}
No Hooks.
Return
Array
. Attributes.
Usage
$WP_Widget_Custom_HTML = new WP_Widget_Custom_HTML(); $WP_Widget_Custom_HTML->_filter_gallery_shortcode_attrs( $attrs );
- $attrs(array) (required)
- Attributes.
Changelog
Since 4.9.0 | Introduced. |
WP_Widget_Custom_HTML::_filter_gallery_shortcode_attrs() WP Widget Custom HTML:: filter gallery shortcode attrs code WP 6.5.2
public function _filter_gallery_shortcode_attrs( $attrs ) { if ( ! is_singular() && empty( $attrs['id'] ) && empty( $attrs['include'] ) ) { $attrs['id'] = -1; } return $attrs; }