Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Created December 17, 2019 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshwaghmare/94f22f223ce833e8886ffd9de5b16d89 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/94f22f223ce833e8886ffd9de5b16d89 to your computer and use it in GitHub Desktop.
Astra Sites `wp-url` script dependency fix for old WordPress versions.
<?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