‘mc4wp_form_message’ filter doesn’t work
-
I wrote a custom validation like described in here on your website..
Using the ‘mc4wp_form_errors’ filter works just fine. But when I want to add an error message, the ‘mc4wp_form_message’ filter simply doesn’t fire. I can’t add the error message via the filter. When I add in the MC4WP plugin directly after the
$messages = (array) apply_filters( 'mc4wp_form_messages', $messages, $form );
it works just fine.
I used your exact example code except for that i use it in a class.add_filter('mc4wp_form_message', array( $this, 'add_mc4wp_error_message'), 10, 2 ); . . . public function add_mc4wp_error_message( $message ) { $messages['my_validation_error'] = array( 'type' => 'error', 'text' => 'my validation error test message' ); return $messages; }When I simply add the same line
$messages['my_validation_error'] = array( 'type' => 'error', 'text' => 'my validation error test message' );
right after the apply_filter line (class-form.php lime 276 in your plugin), my error message gets displayed. I can’t figure out, why the filter doesn’t fire and add my error message to the array?
Could you please nudge me in the right direction or provide a working example?
Thank you very much in advance for your support.
The topic ‘‘mc4wp_form_message’ filter doesn’t work’ is closed to new replies.