Why is Wordpress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?

In attempting to boost the performance of my website, I've noticed that Wordpress is enqueuing a lot of the admin r

In attempting to boost the performance of my website, I've noticed that Wordpress is enqueuing a lot of the admin relevant scripts and stylesheets on the front end.

I'm wondering how I can stop this from happening...I was thinking about dequeueing all of the offending, but then my server response time would be slightly slowed.

Is there a tried and tested way of doing this?

In attempting to boost the performance of my website, I've noticed that Wordpress is enqueuing a lot of the admin relevant scripts and stylesheets on the front end.

I'm wondering how I can stop this from happening...I was thinking about dequeueing all of the offending, but then my server response time would be slightly slowed.

Is there a tried and tested way of doing this?

Share Improve this question asked Apr 5, 2019 at 16:38 Micheal J. RobertsMicheal J. Roberts 1033 bronze badges 9
  • The only scripts that should be enqueued from the front-end are /wp-includes/js/wp-embed.min.js and /wp-includes/js/wp-emoji-release.min.js. If other scripts are enqueued, something in your theme or plugins must be doing this. – MikeNGarrett Commented Apr 5, 2019 at 16:41
  • Yeh, I think that's kind of what I'm asking. i.e., how to stop this behaviour. It's a custom theme, and haven't set anything up in place. I have everything that is available when logged in available when not and on the front end... – Micheal J. Roberts Commented Apr 5, 2019 at 16:43
  • @MikeNGarrett Very minimal amount of plugins installed, mainly just using ACF. Wordpress version is the latest version as well, as of today. It's not a bug is it? – Micheal J. Roberts Commented Apr 5, 2019 at 16:45
  • Just to make sure, are you looking at the front-end as a logged-in user or are you totally logged out? – MikeNGarrett Commented Apr 5, 2019 at 16:46
  • 1 @MikeNGarrett Hi Mike - your suggestion of changing the naming conventions of the enqueued scripts and styles worked, so there must have been something non-unique in the names of one of these that was causing a conflict. Obvious when I think about it. Wordpress 101. If you answer with this, I can accept. Many thanks if you don't have time. – Micheal J. Roberts Commented Apr 8, 2019 at 9:19
 |  Show 4 more comments

1 Answer 1

Reset to default 1

If your bootstrap or other enqueued scripts have a dependency or name conflict, this could enqueue all these scripts. There are a large number of common scripts in WordPress core that are enqueued under common names. I always recommend prefixing your script names with something specific.

wp_enqueue_script( 'theme-bootstrap', 'https://stackpath.bootstrapcdn/bootstrap/4.3.1/js/bootstrap.min.js', array( 'jquery' ), '4.3.1', true );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745615454a4636207.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信