Why I cannot deregister woocommerce styles within the theme?

Hi there,

I know that reviewers using the themeforest-check plugin to test the WordPress themes and that one of the plugin check is to prevent to deregister core scripts.

The reviewer has told me to remove the wp_deregister_style and wp_deregister_script from the theme even if I deregister third part plugins assests like: contact form 7 styles and woocommerce styles.

Why I want to deregister those assest?
Because instead of load the entire word and create strange, complicated and place important keyword everywhere I can create a clean and maintainable css rules.

So, can you clarify why if the check is for do not deregister core script I cannot deregister third part plugins assets?
Don’t tell me that a theme should only stylize the content because within the theme forest repository there are a lots of themes that include admin logic and even some plugin territory code.

There are real guidelines that reviewers must follow? Or an author is in no one man’s hands?

Thank you.

You can but not probably within the theme. Create one plugin, add deregister functions inside of it, use TGM plugin to active it

Or basically, you can overwrite the styles within theme main style file. You don’t actually need it

Hi,

Thank you for the reply.

I know how to setup a plugin and require it via TGMPA but the question is different.

I’m talking about the fact that I’ll not use the deregister functions to deregister the Wordpress Core Scripts but the third party assets.

The theme check plugin says:

WARNING: Found wp_deregister_script in functions.php. Themes must not deregister core scripts.

Core scripts not plugins nor third party assets.

That’s why I’m asking again, why I cannot deregister third party assets?

Why it is possible to include admin and plugin territory logic but not to do a simple thing, (as the rest of the world do) like prevent to make a theme heavy because you need to request 3 different stylesheet and then override the rules by making a Css abomination?

Really that make sense for you?

You missed my point. Create a simple plugin, dump all your de-register codes inside of it and activate it on the theme installation (via TGM)

<?php
    /*
    Plugin Name: Example Plugin
    */

    function remove_all_scripts() {
   foreach( wp_scripts()->registered as $script ) {
      wp_dequeue_script( $script );
      wp_deregister_script( $script );
  }
} 
add_action('wp_enqueue_scripts', 'remove_all_scripts', PHP_INT_MAX);

No I haven’t missed your point.

I actually use a solution within my framework plugin that do exactly what I need.

The question remains.

So,

There is no way to talk to some administrator or reviewer or to have detailed infos about the review process?
Are you sure it is not possible to deregister third party assets from the theme env?

I asked on #themereview on slack forum for themes that will be uploaded on WordPress.org repo and them told me that
I can do that.

So why theme forest doesn’t allow this behavior?

Is the review process in line with the requirements of WordPress.org?