• https://contactform7.com/getting-default-values-from-shortcode-attributes/

    I follow this, and create a custom php code, work for text inputs, but dosan’t work in checkboxs,

    I would like to control the checkboxes that are checked by default via PHP, using this it worked for only 1 checkbox field, I need it to work for one more option, I tried using array , but it didn’t work.
    my code that works for just 1 check

    In form: [checkbox checkbox1 default:shortcode_attr use_label_element “option a” “option b” “option c”]

    In PHP:

        add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter’, 10, 3 );

        function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) {

            $out[“checkbox1”] = “option b”;

            return $out;

        }

  • The topic ‘default values from shortcode in checkbox’ is closed to new replies.