admin管理员组文章数量:1277887
I've been with this problem for a couple of days and the truth is that I can not find a solution. I have added code manually in wp-header.php and now I need to delete these lines that it generates automatically
The lines I want to eliminate are:
<link rel="stylesheet" id="create-css" href=".css?ver=4.9.8" type="text/css" media="all" data-inprogress="">
<script type="text/javascript" src=".min.js?ver=1.4.1"></script>
<script type="text/javascript" src=".js?ver=1.12.4"></script>
thaks!!
I've been with this problem for a couple of days and the truth is that I can not find a solution. I have added code manually in wp-header.php and now I need to delete these lines that it generates automatically
The lines I want to eliminate are:
<link rel="stylesheet" id="create-css" href="http://www.myweb/wp-content/themes/movil/create.css?ver=4.9.8" type="text/css" media="all" data-inprogress="">
<script type="text/javascript" src="http://www.myweb/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1"></script>
<script type="text/javascript" src="http://www.myweb/wp-includes/js/jquery/jquery.js?ver=1.12.4"></script>
thaks!!
Share Improve this question edited Nov 24, 2018 at 10:47 LuisCG asked Nov 24, 2018 at 10:44 LuisCGLuisCG 12 bronze badges 6- 1 What code did you ad manually? You shouldn't add scripts and styles to the header manually. – Jacob Peattie Commented Nov 24, 2018 at 10:46
- We are trying to pass the web from http to https, but we do not know why those three codes are not edited and they always remain in http giving errors on the page. – LuisCG Commented Nov 24, 2018 at 10:54
- What we have done is add those same three codes but with https manually and now we want to eliminate those that generates <?php wp_head(); ?> – LuisCG Commented Nov 24, 2018 at 10:56
- you should remove what you have added manually and add https in the site url and home page url in settings. – Akshat Commented Nov 24, 2018 at 11:01
- The whole web is already working in https, we have added the url in the configuration of the site, but those three codes are not edited and we do not know why it happens. That is why we have decided to add it manually in the wp-head.php and try to eliminate it from the <?php wp_head(); ?> – LuisCG Commented Nov 24, 2018 at 11:03
2 Answers
Reset to default 1Sounds like some filter is placing the create.css file there. Check your functions.php (or search for the following function inside the theme with your text editor in case some other file is enqueueing those assets) for wp_enqueue_style
and see if you have that file enqueued.
Other way of doing this is using the filter wp_head
, so, you might have something like this in your functions.php or maybe elsewhere in your theme:
add_action( 'wp_head', 'my_callback_function');
my_callback_function() { ?>
<link rel="stylesheet" id="create-css" href="http://www.myweb/wp-content/themes/movil/create.css?ver=4.9.8" type="text/css" media="all" data-inprogress="">
<?php
}
If you want to delete the code above you can, but instead of manually placing the tag, you should use something like the code below, again, in your functions.php:
add_action('wp_enqueue_scripts', 'my_callback_function');
function my_callback_function() {
wp_enqueue_style('create-style', get_stylesheet_directory_uri() . '/create.css');
}
The script tags you are seeing in your website normally come from the WordPress core, so you won't have to delete them, placing them again, or do anything, WordPress handles that for you and it will use http or https depending on your configuration.
The possibility exists that someone overwrote the enqueueing of the scripts (if http doesn't change automatically to https when you configure https in your website, then something is not right) to use something different to what the WordPress core gives you, in which case you should search and see if somewhere in your theme the filter wp_head
or the function wp_enqueue_script
is being used to put those files there.
It sounds like you should backup your site first. Then go in to the editor under appearance, and find the file your looking for. Its usually under appearance on the dashboard.
Appearance > Editor
Then you can delete the files in question.
If they are styles and scripts, deleting them may break certain functions, or make your site look odd.
If you are hosting the stylesheets and scripts on your website, and you have converted all other links on the website, you should probably just add an "s" into the http:// protocol, changing it to https://
本文标签: javascriptRemove CSS amp JS from ltphp wphead() gt
版权声明:本文标题:javascript - Remove CSS & JS from <?php wp_head(); ?> 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741299377a2371004.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论