Created
December 17, 2019 12:15
-
-
Save maheshwaghmare/94f22f223ce833e8886ffd9de5b16d89 to your computer and use it in GitHub Desktop.
Astra Sites `wp-url` script dependency fix for old WordPress versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Astra Sites `wp-url` script dependency fix for old WordPress versions. | |
* | |
* @todo Change the `prefix_` and with your own unique prefix. | |
* | |
* @since 1.0.0 | |
*/ | |
if( ! function_exists( 'prefix_backward_compatibility' ) ) : | |
function prefix_backward_compatibility() { | |
global $wp_version; | |
// If version is above 4.9 then don't execute the code and return. | |
if( version_compare($wp_version, '4.9', '>') ) { | |
return; | |
} | |
// De-register. | |
wp_deregister_script( 'astra-sites-admin-page' ); | |
// Enqueue. | |
wp_enqueue_script( 'astra-sites-admin-page', ASTRA_SITES_URI . 'inc/assets/js/admin-page.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_SITES_VER, true ); | |
} | |
add_action( 'admin_enqueue_scripts', 'prefix_backward_compatibility', 11 ); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment