Home Forums Backend Issues (wp-admin) ReferenceError: acf is not defined Reply To: ReferenceError: acf is not defined

  • Hello Elliot

    Thx for the quick reply. This however didn’t fix the problem.

    If I take a look at the acf_form_wp_head function I see the following:

    function acf_form_wp_head()

    So in fact I already did the do_action part, only from within a function (which I called in my custom code).

    I’ve tried some other placements for the do_action in my code but this didn’t work either. I’m not a frequent WordPress user so I’m not sure what to try next.

    This is the current situation:
    I’ve added a hook to a custom function:
    add_action('admin_head', 'cjobs_admin_head');

    In that function I’ve put the do_action:

    function cjobs_admin_head()

    This is already something different than the code I used in version 3.x. In that version all I had to do was call the acf_form_wp_head function just before parsing the acf fields.

    This is the acf_form_wp_head function in version 3.x:

    function acf_form_wp_head()
    	// global vars
    	global $post, $acf;
    	// Style
    	echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/global.css?ver=' . $acf->version . '" />';
    	echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/input.css?ver=' . $acf->version . '" />';
    	// Javascript
    	echo '<script type="text/javascript" src="'.$acf->dir.'/js/input-actions.js?ver=' . $acf->version . '" ></script>';
    	// add user js + css