Remove CSS & JS from <?php wp_head(); ?>

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.com/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.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1"/script

script type="text/javascript" src="http://www.myweb.com/wp-includes/js/jquery/jquery.js?ver=1.12.4"/script

thaks!!

Topic wp-head css Wordpress javascript

Category Web


Sounds 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.com/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://

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.