Scripts not loading
-
Hey there,
Currently when your widget is loaded in a context outside widgets.php or the Customizer, the scripts required for the admin form don’t load. So, for example, if using Beaver Builder’s widget module, the form breaks and the widget can’t be used.
Rather than only load the scripts on certain screens, you might move the admin form’s script and style registration into the callback that renders the form. This would ensure that anytime the form is loaded, so are the scripts and styles. This would probably require moving these scripts/styles into the footer, but I should imagine that’s fine.
If there’s a git repo, I’d happily add a pull request.
Also when you register/enqueue your scripts and styles, you only need to include paths when registering them. You’ve redundantly passed the paths when enqueueing, as well.
- The topic ‘Scripts not loading’ is closed to new replies.