WP HOOKS
filtrdynamicznyod 3.6.0

shortcode_atts_{$shortcode}

Args 4Plik wp-includes/shortcodes.php

Opis

Filtruje domyślne atrybuty konkretnego shortcode’a — np. shortcode_atts_gallery.

Przykład użycia

add_filter( 'shortcode_atts_{$shortcode}', ... )php
add_filter( 'shortcode_atts_gallery', 'wpdocs_gallery_atts' );

function wpdocs_gallery_atts( $out ) {
	$out['columns'] = 3;
	return $out;
}

If the third parameter of the shortcode_atts() function is present then this filter is available. The third parameter, $shortcode, is the name of the shortcode.

Parametry

ParametrTypOpis
$outarrayThe output array of shortcode attributes.
$pairsarrayThe supported attributes and their defaults.
$attsarrayThe user defined shortcode attributes.
$shortcodestringThe shortcode name.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'shortcode_atts_{$shortcode}', 'twoja_funkcja', 10, 4 );

function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
	// Twój kod
}