• Resolved jasonbear

    (@jasonbear)


    CriticalCSS customer here.

    Can you please make it so that the critical CSS gets inserted *AFTER* all of WordPress’ SEO tags? In other words, can you please insert it as the very last element before </head>?

    My critical CSS is quite lengthy, making it impossible to easily “view source” of my SEO tags within <head></head> because they are pushed so far down the “view source” window. That’s bad for bots like Googlebot, as well. Please advise.

    • This topic was modified 3 years, 2 months ago by jasonbear.
    • This topic was modified 3 years, 2 months ago by jasonbear.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    you should be able to do that using below code snippet Jason;

    add_filter('autoptimize_filter_css_replacetag','override_css_replacetag',10,1);
    function override_css_replacetag($replacetag) {
        return array('</head>','before');
    }

    hope this helps,
    frank

    Thread Starter jasonbear

    (@jasonbear)

    Can you please tell me where, exactly, I should place that code? Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    The easiest & safest solution is using the code snippets plugin.

    Thread Starter jasonbear

    (@jasonbear)

    I just added it to my child theme’s functions.php file and all is well!

    Just out of curiosity, is there a particular reason why you have not made this “insert after SEO tags” placement the default?

    Thanks!

    • This reply was modified 3 years, 1 month ago by jasonbear.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Critical CSS: Please insert *AFTER* all SEO tags in the [head]’ is closed to new replies.