Troubleshooting //
Images Are Not Displayed Correctly When Logged Out

Images Are Not Displayed Correctly When Logged Out

Question

Images are loading fine when logged in but they do not appear when logged out

Answer

This issue might happen with the Image Comparison and Accordion widgets. The reason for that is the
incorrect sequence of script connections. Below is the error that you can see in such cases:

imagesLoaded error in the console
  1. Go to the WordPress Dashboard.

  2. Open the Appearance tab and click Theme Editor.

  3. Select the child theme.

  4. Proceed to Theme Functions (functions.php).

  5. Add the following code to functions.php:

    add_action( 'init', function(){
    global $wp_scripts;
     
    $script = $wp_scripts->query( 'imagesloaded', 'registered' );
     
    if ( ! $script ) {
    return;
    }
     
    if ( ! in_array( 'jquery', $script->deps ) ){
    $script->deps[] = 'jquery';
    }
    } );
    
    inserted code into the theme functions.php file
  6. Save the changes.

Was this article helpful?
YesNo
Still need help?
Submit a request