Support

Account

Home Forums ACF PRO Get Jquery from Advanced Custom Fields value Reply To: Get Jquery from Advanced Custom Fields value

  • In case it is option page

    <script>
    var testVar = "<?=get_field('field_name','option'); ?>";
    </script>

    In case it is CPT:

    <script>
    var testVar = "<?=get_field('field_name',$post_id); ?>";
    </script>

    So, now you can use testVar in your jQuery after loading page

    Trick:
    store php & MySql value in hidden inputs with known id and then get this input value by its id in your jQUery code