• Hi,

    I’ve created a couple of custom widgets and unregistered all WordPress default widgets, including media (audio, image, video) and text widgets.

    Thus, media-widgets and text-widgets WordPress scripts are not called any more on the widgets admin panel, making Javascript objects wp.mediaWidgets and wp.textWidgets undefined.

    Your plugin breaks since it tries to access these global objects in pw-media-widgets-extend-wp-media-widgets.js and pw-text-widgets-extend-wp-text-widgets.js.

    I fixed it by adding :

    wp_enqueue_script('media-widgets');
    wp_enqueue_script('text-widgets');

    near the end of your pw_print_scripts PHP function.

    Can you please include this fix in the next release of your plugin?

    Thanks,
    Vincent

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author CodeAndMore

    (@codeandmore)

    Thanks for that,
    We will review and add code in if correct.

    Thread Starter Vincent Robic

    (@vrobic)

    You’re welcome! It’s a very specific case, and not very common to unregister all widgets.

    Plugin Author CodeAndMore

    (@codeandmore)

    Hi Vincent,
    Many thanks for your suggestion but we decide to not include your fix in our plugin as it is not common case.
    When UNREGISTERED all WordPress default widgets, including media (audio, image, video) and text widgets => media-widgets, text-widgets js will also be removed. That why you must add some code when you want to customize things.
    Best regards,
    CodeAndMore

    Thread Starter Vincent Robic

    (@vrobic)

    We use your plugin on some of our client’s projects and I’m sad that you won’t do anything since I gave the fix. Should a bug be ignored if only one user encountered it?

    A quality plugin should plug in every WordPress setup, whether core widgets has been unregistered or not.

    Hope you’ll reconsider your choice.

    Cheers,
    Vincent

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fixed a bug after unregistering default media and text widgets’ is closed to new replies.