• Hey, how can I get the current post id within the wpcf7_swv_create_schema hook? I need to limit the checkboxes by an acf number field of the current post. so instead of the first $max = 2; i need it to be the commented out get_field.

    add_action('wpcf7_swv_create_schema',function ( $schema, $contact_form ) {
    $max = 2;
    // $max = get_field('maximum_themen', get_the_ID());
    $schema->add_rule(
    wpcf7_swv_create_rule( 'maxitems', array(
    'field' => 'your-unterkategorien',
    'threshold' => $max,
    'error' => "Maximum ".$max." Themen",
    ) )
    );
    }, 10, 2);

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get current post ID in wpcf7_swv_create_schema hook’ is closed to new replies.