1. Home
  2. Docs
  3. Developers “How To’s”
  4. Change Default Value of Param

Change Default Value of Param

It is possible to change default value of existing params.

<?php
add_action('vc_after_init', function() {
  $newParamData = array(
  'type' => 'textfield',
  'heading' => __( 'Image size', 'js_composer' ),
  'param_name' => 'img_size',
  'value' => 'full', // New default value
  'description' => __( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)).', 'js_composer' ),
  'dependency' => array(
  'element' => 'source',
  'value' => array( 'media_library', 'featured_image' ),
  ),
  ); 
 
  vc_update_shortcode_param( 'vc_single_image', $newParamData );
}
);