function shortcode_atts($pairs, $atts) {}

Combine user attributes with known attributes and fill in defaults when needed.
The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.


  • array $pairs: Entire list of supported attributes and their defaults.
  • array $atts: User defined attributes in shortcode tag.

Return values

returns:Combined and filtered attribute list.

Source code

function shortcode_atts($pairs, $atts) {

	$atts = (array)$atts;

	$out = array();

	foreach($pairs as $name => $default) {

		if ( array_key_exists($name, $atts) )

			$out[$name] = $atts[$name];


			$out[$name] = $default;


	return $out;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: