Available for Hire

Set fields default value for visual composer

I am developing a WordPress theme which will be run via WPBakery visual composer and I had to set a default value for some of the fields. I was looking on the web if there any solution to set the default value but I could not find any so I start looking the plugin and found a way of setting default value though the original plugin developer have not listed that on any of the documentation.

So if you want to set a default value for dropdown field setting default value then:
vc_add_param( 'vc_row', array(
'type' => 'dropdown',
'heading' => __( 'Text Color Scheme', 'js_composer' ),
'param_name' => 'color_scheme',
'value' => array(
'Light' => 'light',
'Dark' => 'dark',
'Custom' => 'custom'
'std' => 'dark'
) );

From the above code you can see the ‘std’ key in the array that sets the default value.