Support

Account

Home Forums Backend Issues (wp-admin) Validate one field against another Reply To: Validate one field against another

  • I found workaround:

    add_action( 'admin_footer', function() {
    	?>
    	<script type="text/javascript">
    		var tmp_acf_serialize_form = acf.serialize_form;
    		acf.serialize_form = function( $el, prefix ) {
    			var data = tmp_acf_serialize_form( $el, prefix );
    			data['post_id'] = <?php echo get_the_id(); ?>;
    			return data;
    		}
    	</script>
    	<?php
    } );

    and now in add_filter( 'acf/validate_value/... you can use $_REQUEST['post_id'];

    There’s needs to be checked if acf exists in js…