Support

Account

Home Forums General Issues Load JS script after ACF Reply To: Load JS script after ACF

  • Thank you Speakincode, that was a very good answer. I will try to answer better to clear things up a bit. I am trying to get ACF data using JS to post to the DOM (do I need PHP?).
    This seems to work much better now, but I still don’t get the right things from ACF, I am trying this:

    var acfVersion = acf.get('acf_version');
    alert(acfVersion);

    Maby it´s wrong.. I get ‘null’.

    And this is the functions.php code:

    add_action('acf/init', 'my_acf_admin_footer');
    function my_acf_admin_footer() {
      wp_register_script( 'custom-acf-js', get_template_directory_uri() . '/library/scripts/script-js.js', ['acf-input'], '1.0.0', true);
      wp_enqueue_script('custom-acf-js');
    }