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…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.