Home › Forums › General Issues › Admin errors since 5.5.13 PRO update
Hi guys,
Since 5.5.13 Update i’ve got error messages explaining that wp_register_script is not called correctly and should be called using wp_enqueue_scripts, admin_enqueue_scripts or login_enqueue_scripts and this error is in /data1user/dev.gramms.fr/htdocs/wp-includes/functions.php on line 4138.
I’ve got in my functions.php theme a function creating an array of price and i get some informations using codes like this one:
$reference = get_field(‘reference’, $confiserie->ID);
When i comment those lines I’ve no more error messages.
I reverted back to 5.5.12 and no problem anymore.
Can someone enlightne me plz ?
@kevinw What type of a field is the field your calling reference
and what is being stored in that field? It doesn’t make any sense you are commenting out would cause this error.
Still does not make much sense that commenting out that line is correcting the issue. Does the field contain some type of JavaScript? Shortcodes? Something that would be called when formatting the value that is also causing a script to be registered?
Here is a reduced version of mine:
global $tab_prix;
$tab_prix = tab_prix(get_current_user_role());
function tab_prix($user_role) {
$args = array(
'posts_per_page' => -1,
'offset' => 0,
'post_type' => 'confiserie',
'post_status' => array('publish', 'private'),
'suppress_filters' => true
);
$confiseries = get_posts( $args );
foreach($confiseries as $confiserie) {
$reference = get_field('reference', $confiserie->ID);
$refs = get_field('reference_secondaire', $confiserie->ID);
}
}
When i comment out the lines with getfield no error at all and on 5.5.12 still no error but on 5.5.13 I get the same error as I said on my post.
I know it doesn’t make sense but well i’m stuck at 5.5.12 at the moment.
@emailmikespainhower-com I can confirm that the code you supplied causes this error.
Change your action to run on the ‘after_theme_setup’
@kevinw I don’t know if you have a similar issue, but it’s more than likely that you are trying to access acf before it has been initialized.
It appears that accessing fields before ACF is ready causes ACF to initialize early, including registering scripts and styles and this early initialization is what’s causing the errors.
sorry, I typed that wrong… a always type this hook wrong… it should be after_setup_theme
(reposting my comment from above as I’m unable to mark it ‘public’):
I’m seeing this too. A reduced version of the code that causes it for me (pasted at the top of twentyseventeen’s functions.php):
function my_setup() {
if(function_exists('get_field')) {
$ga = get_field('google_analytics_id', 'option'); // text field
}
}
add_action('after_setup_theme','my_setup');
gives:
Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /wp-includes/functions.php on line 4138
Hi guys,
the 5.5.14 update resolved the problem.
With or wihtout
function my_setup() {
if(function_exists('get_field')) {
....
}
}
add_action('after_setup_theme','my_setup');
I don’t get the error anymore
The topic ‘Admin errors since 5.5.13 PRO update’ is closed to new replies.
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.