Support

Account

Home Forums General Issues validate_value filter doesn't work Reply To: validate_value filter doesn't work

  • Ok, sorry this project went dead for a while, but I’m back at it and still having the same issue. I tried disabling all plug-ins except ACF and changing the template, but I’m still having the same problem. I don’t know if it will help, but this is my add_filter code:

    function fe_profile_validate_about_me( $valid, $value, $field, $input ) {
        
        //only run in on profiles
        if( is_admin()  || ! get_post_type() == 'profiles' )
        {
            return $valid;
        }
    
        $cleaned_value = wp_strip_all_tags( $value );
    
        if( strlen( $cleaned_value ) > 515 ) {
            $valid = '<div style="text-align: center"><h3>Unable to update your profile</h3>
            <p>We were unable to update your profile because your "About Me" was longer than 515 characters.</p>
            <p><a href="javascript:void(0);" onclick="window.location.reload(true);" class="button">Back to profile</a></p></div>';
        }
    
        return $valid;
    }
    add_filter('acf/validate_value/name=fe-profile-short-description', 'fe_profile_validate_about_me', 10, 4);