Adding form field to Top Bar not working
-
Hi,
I’ve added the following code to functions.php
add_action( 'mctb_before_submit_button', function() { echo '<input type="hidden" name="SOURCE" id="SOURCE" value="MC4WP TopBar" />'; }); add_filter( 'mctb_data', function( $vars ) { $vars['SOURCE'] = ( isset( $_POST['SOURCE'] ) ) ? sanitize_text_field( $_POST['SOURCE'] ) : ''; return $vars; });And when I inspect the HTML of the live page in Chrome it shows the following above the submit button:
<input type="hidden" name="SOURCE" id="SOURCE" value="MC4WP TopBar">But MailChimp doesn’t pick up any value for SOURCE. How can I get it to work?
I also added the following line to the form of the regular MC4WP plugin (not the top bar) and it works fine:
<input type="hidden" name="SOURCE" id="SOURCE" value="MC4WP OnPage" />Cheers,
Pete
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Adding form field to Top Bar not working’ is closed to new replies.