• Resolved James Hunt

    (@bonkerz)


    Hey

    I’m using this plugin for a countdown on a few pages of my site but I’m getting an error. I’ve installed a function to prevent render blocking on my site and move all scripts to footer. I’ve used this function on a lot of sites, but on this site and using your plugin, an error is throw.

    Fatal error: Cannot redeclare ub_getNamesOfPresentBlocks() (previously declared in /app/web/wp-content/plugins/ultimate-blocks/src/init.php:61) in /app/web/wp-content/plugins/ultimate-blocks/src/init.php on line 61

    Any ideas why this would be and what I could do to solve?

    The function I am using to prevent render blocking is pretty standard:

    if ( ! is_admin() ) {
    	function defer_parsing_of_js ( $url ) {
    		if ( FALSE === strpos( $url, '.js' ) ) return $url;
    		if ( strpos( $url, 'jquery-3.4.1.min.js' ) ) return $url;
    		return "$url' defer";
    		}
    add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
    }

    The error is shown on pages that are not even using UB blocks.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Imtiaz Rayhan

    (@imtiazrayhan)

    Hi James,

    I am really sorry about that. I am not sure why that happened. I will try to replicate it on my end and see if I can come up with something.

    Thanks for the function. That will be helpful.

    I will get back to you here as soon as I have something.

    Regards.

    Plugin Author Imtiaz Rayhan

    (@imtiazrayhan)

    Hi James,

    We did some tests. I believe you are using an older version of the plugin. Because we don’t have that function since version 2.1.2.

    Please update the plugin to the latest version. That should fix it.

    Let me know if you still face issues after the update.

    Regards.

    Thread Starter James Hunt

    (@bonkerz)

    Hey you are right, it’s on version 1.1.9. Apologies for seemingly wasting your time. I will get it upgraded.

    Plugin Author Imtiaz Rayhan

    (@imtiazrayhan)

    No worries. Please reach out to us anytime with any issues.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fixing render blocking JS gives error’ is closed to new replies.