N
N
Nikita Souvel2016-02-23 02:10:07
WordPress
Nikita Souvel, 2016-02-23 02:10:07

How can wp_print_styles be moved from wp_head to wp_footer?

I wondered about the topic of optimization, I got stuck at the stage of transferring the connection of styles to the footer of the site ...
Actually, this function clings to default-filters.php

add_action( 'wp_head',             'wp_print_styles',                  8    );

I tried deleting in the theme 's functions.php
remove_action('wp_head', 'wp_print_styles');
file and like this:
function disable_wp_style() {
  remove_action('wp_head', 'wp_print_styles');
}
add_action( 'init', 'disable_wp_style' );

It doesn’t work out at all ...
How can you still turn it off, maybe someone can do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zhainar, 2016-02-23
@Souvel1

Try this

function disable_wp_style() {
  remove_action( 'wp_head',             'wp_print_styles',                  8    );
}
add_action( 'wp_head',             'disable_wp_style',                  1  );

E
Egor, 2016-02-23
@DarkSir

Why not just remove the styles you want with wp_dequeue_style and then re-add them where needed?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question