• Resolved moisb

    (@moisb)


    Hi, I have a improvement suggestion: add optimization exception option by post type or custom taxonomy.
    For some post types that are not important for SEO it would be much easier to have the option to add the post type as an exception, instead of looking for the conflicting javascript or css selector.

    Do not load the plugin on certain pages by URI patterns also looks very interesting

    • This topic was modified 3 years, 5 months ago by moisb.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author asadkn

    (@asadkn)

    Good suggestion. Will look into in future.

    Note that there are many filters available for exceptions. You can programmatically disable it on any page if you have some coding experience, using the filters debloat/should_optimize_js and debloat/should_optimize_css.

    Thread Starter moisb

    (@moisb)

    thanks @asadkn. When you can, post some examples of real use of these filters, please. I’m not a programmer, so I don’t know exactly how to do it.

    Thread Starter moisb

    (@moisb)

    Hello @asadkn. Today I had more time to search on your plugin code and study wordpress filters. I tried it as follows, and it worked!
    I leave here the code snippet as an example for more people with the same question:

    add_filter('debloat/should_optimize_js', function ($enable_on) {
      if ( is_singular('testimonial')) {
            return false;
        }
        return $enable_on;
    });

    I just needed to disable JS optimization on this specific post type because it caused conflicts with a modal javascript.

    I just had a little doubt. Do I need to add a condition to check if the Debloat plugin is active? If so, what is the main class name to use in “if class_exists”?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘more exception options’ is closed to new replies.