The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
AI Assistant
wp_register_script ...
 
Notifications
Clear all

Question [Solved] wp_register_script - wpdiscuz-combo-js - 'strategy' => 'defer' ?

2 Posts
2 Users
0 Reactions
869 Views
 JDO
(@jdo)
Posts: 1
New Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#8499]

What is the reason that the wpdiscuz-combo-js is >not< registered  with 'strategy' => 'defer' (or at least configureable) ?

I had some problems with "ReferenceError: jQuery is not defined at wpdiscuz-combo.min.js?ver=7.6.19:8:1", which are solveable with using defer.


 
Posted : 02/06/2024 3:44 pm
Asti
 Asti
(@asti)
Posts: 8284
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi,

You can use the hook code below. It allows you to add the attributes you want to any js code: 

add_filter('script_loader_src', 'custom_script_loader_src', 10, 2);
function custom_script_loader_src($src, $handle) {
    if ($handle !== 'wpdiscuz-combo-js') {
        return $src;
    }
    return $src . "'&nbsp;defer";
}

In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 04/06/2024 2:00 pm