admin管理员组文章数量:1026989
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 | Show 4 more comments1 Answer
Reset to default 1If 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 );
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
1 Answer
Reset to default 1If 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 );
本文标签:
版权声明:本文标题:Why is Wordpress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745615452a2159262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
/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