shortcode_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.
If the $atts list has unsupported attributes, then they will be ignored and removed from the final returned list.
Hooks from the function
Return
Array
. Combined and filtered attribute list.
Usage
shortcode_atts( $pairs, $atts, $shortcode );
- $pairs(array) (required)
- Entire list of supported attributes and their defaults.
- $atts(array) (required)
- User defined attributes in shortcode tag.
- $shortcode(string)
- The name of the shortcode, provided for context to enable filtering
Default: ''
Changelog
Since 2.5.0 | Introduced. |