Support » Plugin: Lazy Load for Videos » WordPress 5.8 PHP Nitoce

  • Just updated to WordPress 5.8 and started receiving a notice in the WordPress admin on the new widgets.php page. Through process of elimination I narrowed the issue down to this plugin.

    This is the notice I’m now receiving: Notice: wp_enqueue_script() was called incorrectly. “wp-editor” script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see Debugging in WordPress for more information. (This message was added in version 5.8.0.) in /nas/content/live/site-name/wp-includes/functions.php on line 5535

Viewing 1 replies (of 1 total)
  • Thread Starter wbmessenger

    (@wbmessenger)

    For anyone needing a patch for this issue see below. Essentially we just need to check the WP version and update the dependency.

    File: /lazy-load-for-videos/src/php/class-editor.php
    Line: Replace lines 19-24 with below snippet.

    /* 
    * - Check the WordPress version and adjust the editor dependency if less that v5.2 
    * - This throws a PHP notice about improperly enqueueing a script file if left unchecked
    */
    
    global $wp_version;
    version_compare( $wp_version, '5.2', '>' ) ? $wp_editor = 'wp-block-editor' : $wp_editor = 'wp-editor';
    		
    wp_enqueue_script(
      'lazyload-editor-js',
      LL_URL . 'public/js/editor.js',
      [ 'wp-blocks', 'wp-element', $wp_editor, 'wp-components', 'lodash' ],
      SCRIPT_DEBUG ? null : LL_VERSION
    );
    
    • This reply was modified 2 months, 3 weeks ago by wbmessenger.
    • This reply was modified 2 months, 3 weeks ago by wbmessenger.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.