PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Undefined array key "woof_front"

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi there.

I am running a website on WordPress / Divi theme/builder and on every page load, I get the following error:

PHP Warning: Undefined array key"woof_front" in /home/siteusr/public_html/wp-content/themes/Divi/includes/builder/feature/JQueryBody.php on line 249

Are you able to advise regarding this issue please? This is the only recurring error in the log.

Thanks in anticipation.

Hello

But this error occurs in the theme, not in my plugin

Can you  drop me  screenshots  of  the  code - in /home/siteusr/public_html/wp-content/themes/Divi/includes/builder/feature/JQueryBody.php on line 249

I'll look at possible reasons

Here's a snippet taken from that file, including the full function. I have highlighted line 249 and labelled it too:

public function wp_print_scripts() {
global $shortname;
if ( $this->should_move_jquery() ) {
global $wp_scripts;
$queue = $this->get_deps( $wp_scripts->queue );
$head  = in_array( 'jquery-migrate', $queue, true ) ? [ 'jquery-migrate' ] : [];
$mode  = 'on' === et_get_option( $shortname . '_enable_jquery_body_super' ) ? 'super' : 'safe';
// Find all head scripts that depends on JQuery.
foreach ( $queue as $handle ) {
if ( $this->in_head( $handle ) && $this->has_jquery_dep( $handle ) ) {
if ( 'safe' === $mode && 'jquery' !== $handle && 'jquery-migrate' !== $handle ) {
// Bail out when a script requiring jQuery is found in head.
return;
}
$head[] = $handle;
}
}
$registered = $wp_scripts->registered;
// Disable the feature when finding a script which does not depend on jQuery
// but still uses it inside its inlined content (before/after).
foreach ( $queue as $handle ) {
if ( ! $this->has_jquery_dep( $handle ) ) {
$script = $registered[ $handle ];   // line 249
$data   = '';
if ( isset( $script->extra['data'] ) ) {
$data .= $script->extra['data'];
}
if ( isset( $script->extra['before'] ) ) {
$data .= join( '', $script->extra['before'] );
}
if ( isset( $script->extra['after'] ) ) {
$data .= join( '', $script->extra['after'] );
}
if ( ! empty( $data ) && self::has_jquery_content( $data ) ) {
return;
}
}
}// Disable the feature when jQuery is found in TB/Post Content.
if ( self::has_jquery_content( $this->get_all_content() ) ) {

return;

}

if ( ! empty( $head ) ) {

foreach ( $this->get_deps( $head ) as $handle ) {

$wp_scripts->add_data( $handle, 'group', 1 );

}

}

}

}

Any insight you can provide would be amazing! At the moment this error is generating MBs of error logs daily; I could turn the log off, but am keen to find a solution rather than ignore it. Thanks in anticipation.
Dan

Hello Dan

Please  try  this  option - https://c2n.me/4jDuGRV.png

If  no  luck -  try  to  add  code  here - https://c2n.me/4jDuLVM.png

if ( ! $this->has_jquery_dep( $handle )  &&  isset($registered[ $handle ])) {

Hi there.

 

Thanks for your suggested code amend. I did change this but it removes the old error and throws many lines of a new error (but only on the /shop/ page).

BEFORE
[06-Nov-2023 00:35:10 UTC] PHP Warning: Undefined array key"woof_front" in /home/nzschocc/public_html/wp-content/themes/Divi/includes/builder/feature/JQueryBody.php on line 250

AFTER
[06-Nov-2023 00:35:13 UTC] PHP Warning: Undefined property: WP_Post_Type::$post_name in /home/nzschocc/public_html/wp-includes/class-wp-query.php on line 4423

This new error was not present before, so appears to be caused by the new code. Any suggestions appreciated; this is quickly generating 10s of MB per day. I could turn off error reporting/logging but there's obviously an issue to address :)

Dan

Hello Dan

Ok! Delete this  code  and  try  this  option - Advanced->Options - https://share.pluginus.net/image/i20231106123007.png

This is turned on and the same error occurs:
[08-Nov-2023 23:21:49 UTC] PHP Warning: Undefined array key"woof_front" in /home/nzschocc/public_html/wp-content/themes/Divi/includes/builder/feature/JQueryBody.php on line 249

This happens when the optimise setting is on or off.

Hello

Are there options for JS optimization in the theme settings? Please turn this off

The only JS optimisation / JS amendment was Divi:

  1. Dynamic JavaScript Libraries
  2. Defer jQuery And jQuery Migrate - with sub options:
    • Enqueue jQuery Compatibility Script
    • Defer Additional Third Party Scripts

I turned these off, cleared all caches and the issue disappears.

I turned on item (1) and the error is not there. Turning on item (2) the problem returns. When I turn off"Defer Additional Third Party Scripts", the problem is gone.

Does that make sense? Do you know why this would be the case?

Dan

Hello Dan

  • Defer Additional Third Party Scripts  - This option should be used carefully. And it’s better to use specialized plugins for optimization.The main thing is that this option must track dependencies when connecting JS, otherwise it will always cause errors