WP_Widget_Custom_HTML::_filter_gallery_shortcode_attrs()publicWP 4.9.0

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.

Метод класса: WP_Widget_Custom_HTML{}

Хуков нет.

Возвращает

Массив. Attributes.

Использование

$WP_Widget_Custom_HTML = new WP_Widget_Custom_HTML();
$WP_Widget_Custom_HTML->_filter_gallery_shortcode_attrs( $attrs );
$attrs(массив) (обязательный)
Attributes.

Список изменений

С версии 4.9.0 Введена.

Код WP_Widget_Custom_HTML::_filter_gallery_shortcode_attrs() 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;
}