Home Forums ACF PRO Help on Validate Value


Help on Validate Value

  • Hi ma i please ask why this code wont work?
    It goes to an error page like this:
    Instead of telling the v_field_2 that it cannot accept content because the v_field_1 is not empty or already set. TIA

    // Test Validation
    add_filter(‘acf/validate_value/name=v_field_2’, ‘my_acf_validate_value’, 10, 4);

    function my_acf_validate_value( $valid, $value, $field, $input ){

    // bail early if value is already invalid
    if( !$valid ) {
    return $valid;

    if( get_field(‘v_field_1’) != “” ) {
    $valid = ‘Field 1 is already filled up’;

    // return
    return $valid;


  • The cause of the error page being shown can be caused by either a JavaScript error or an error in PHP during the AJAX request.

    For JS errors see if you see any errors reported in console.

    To check for PHP errors see error logging here

  • Hi upon checking it doesnt show any error. on both js and php

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Help on Validate Value’ is closed to new replies.