syntaxhighlighter icon indicating copy to clipboard operation
syntaxhighlighter copied to clipboard

WordPress Defer Functionality Breaks Plugin

Open mandarapte opened this issue 9 years ago • 1 comments

Using 'Defer' in functions.php breaks plugin, It converts all code highlighting to none & make it black on grey background you can have a look on my website: http://mandarapte.com/apple/stop-spam-blocking-spam-senders-ip-address-ultimate-solution-block-spam-order-deny-ip-htaccess/

I am using following code defer or async .js files in footer

Code:

// Adapted from https://gist.github.com/toscho/1584783 add_filter( 'clean_url', function( $url ) { if ( FALSE === strpos( $url, '.js' ) ) { return $url; } return "$url' defer='defer"; }, 11, 1 );

mandarapte avatar Aug 12 '14 10:08 mandarapte

You are correct -- my plugin is not compatible with defer because immediately after the <script> tags is some inline JavaScript that requires that the JavaScript files have already been loaded.

I've been working on a major rewrite of the plugin that moves the inline JavaScript into a static file but even then it may or may not be compatible. It'll depend on the SyntaxHighlighter library itself. We'll see.

Viper007Bond avatar Aug 13 '14 21:08 Viper007Bond