Skip to main content

vc_map_get_attributes

Filters the merged shortcode attributes after combining user-supplied values with registered defaults. This runs after shortcode_atts() processes the values, allowing final modification of all element attributes.

Parameters

ParameterTypeDescription
$attsarrayThe merged array of shortcode attributes (defaults combined with user-supplied values).
$tagstringThe shortcode tag name (e.g., vc_column_text).

Usage

<?php
add_filter( 'vc_map_get_attributes', 'my_modify_element_attributes', 10, 2 );

function my_modify_element_attributes( $atts, $tag ) {
// Force a specific CSS class for all vc_column_text elements
if ( 'vc_column_text' === $tag ) {
$atts['el_class'] = trim( ( $atts['el_class'] ?? '' ) . ' my-custom-class' );
}
return $atts;
}

Source

File: include/helpers/helpers_api.php