Prevent theme styles from being loaded into custom page templates


TV show

I have a website with a wordpress theme. To implement some changes, I created a child theme. very good

Now I want to add a page template that allows me to add styles via wp_enqueue_style. For this, wp_head()if I understand correctly, I need to add to my page template.

I want to use this custom page template for a frontend application (plugin) I am creating. The design of the app is completely separate from the rest of the website. Now when I use I also get all the theme styles wp_head(). I want to prevent the default theme styles from loading.

What is the easiest way to achieve this? Preferably a theme agnostic solution.

TV show

I did some digging in Google and came up with something that matches what I want. After clearing, I can add my own styles and scripts.

function clear_styles_and_scripts() {
    global $wp_scripts;
    global $wp_styles;

    foreach( $wp_scripts->queue as $handle ) :

        wp_dequeue_script( $handle );
        wp_deregister_script( $handle );

    endforeach;

    foreach( $wp_styles ->queue as $handle ) :

        wp_dequeue_style( $handle );
        wp_deregister_style( $handle );

    endforeach;

}
add_action( 'wp_enqueue_scripts', 'clear_styles_and_scripts', 100 );

Related


Prevent theme styles from being loaded into custom page templates

TV show I have a website with a wordpress theme. To implement some changes, I created a child theme. very good Now I want to add a page template that allows me to add styles via wp_enqueue_style. For this, wp_head()if I understand correctly, I need to add to m

Prevent theme styles from loading into custom page templates

TV show I have a website with a wordpress theme. To implement some changes, I created a child theme. very good Now I want to add a page template that allows me to add styles via wp_enqueue_style. For this, wp_head()if I understand correctly, I need to add to m

Prevent theme styles from loading into custom page templates

TV show I have a website with a wordpress theme. To implement some changes, I created a child theme. very good Now I want to add a page template that allows me to add styles via wp_enqueue_style. For this, wp_head()if I understand correctly, I need to add to m

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent forward slashes from being escaped in templates

basic I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2flo

Prevent certain types from being used in templates

inner loop I've designed my own implementation of std::vector, which I'll call il::vector. I think: Specifically for its type, you can use copy memcpy( int, double, std::array<double, n>, etc.). Use other classes for types that cannot be copied, memcpyeg std::

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent forward slashes from being escaped in templates

Basic: I'm converting one of my pet projects from Python to Go just to help me get a feel for the language. One problem I am currently facing is that it is escaping my forward slashes. So it will receive a string like: /location/to/something then becomes %2fl

Prevent certain types from being used in templates

inner loop I've designed my own implementation of std::vector, which I'll call il::vector. I think: Specifically for its type, you can use copy memcpy( int, double, std::array<double, n>, etc.). Use other classes for types that cannot be copied, memcpyeg std::

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile inside the specfolder I want to use with RSpec . However, this file is loaded every time

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile that lives in the specfolder I want to use with RSpec . However, this file is loaded eve

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile that lives in the specfolder I want to use with RSpec . However, this file is loaded eve

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile that is inside the folder I want to specuse with RSpec . However, this file is loaded ev

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile that is inside the folder I want to specuse with RSpec . However, this file is loaded ev

How to prevent RSpec helpers from being loaded

Coding Rabbit Currently, I'm using Capybara to write integration tests for our Rails 4 application. To make it as lightweight as possible, I wrote a capybara_helper.rbfile that is inside the folder I want to specuse with RSpec . However, this file is loaded ev