Filter pchntv_ajax_return_format

Created by Daniel Feldbrugge, Modified on Mon, 11 Dec 2023 at 11:47 AM by Daniel Feldbrugge

Customize the validation format and generate custom messages

add_filter('pchntv_ajax_return_format', 'pchntv_ajax_return_format_custom_code', 1, 10);
function pchntv_ajax_return_format_custom_code($return_format){

    $municipalities = [
        'GM0344', //Gemeente Utrecht
        'GM0935', //Gemeente Maastricht
    ];

    if(in_array($return_format['adres']['municipality_code'], $municipalities)) {
        return $return_format;
    }

    $return_format['adres']['error'] = true;
    $return_format['adres']['message'] = 'Uw adres is niet geschikt';
    $return_format['adres']['found'] = true;

    return $return_format;
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article