Andrew Spackman
asked on
Overriding plugin js file using wp_dequeue_script
Hi,
I need to make some changes to a plugins js file and I want to do it so that it's not overwritten on any plugin updates
The file I am trying to override is wp_enqueue_script( 'dokan-script' );
Then further down in that file its calling the dokan.js file I want to override...
Can someone help me as I'm not sure where to start or where to place my code?
Many Thanks,
Andrew
I need to make some changes to a plugins js file and I want to do it so that it's not overwritten on any plugin updates
The file I am trying to override is wp_enqueue_script( 'dokan-script' );
// store and my account page
if ( dokan_is_store_page() || dokan_is_store_review_page() || is_account_page() || is_product() ) {
if ( DOKAN_LOAD_STYLE ) {
wp_enqueue_style( 'dokan-select2-css' );
}
if ( DOKAN_LOAD_SCRIPTS ) {
self::load_form_validate_script();
$this->load_gmap_script();
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_script( 'dokan-tooltip' );
wp_enqueue_script( 'dokan-chosen' );
wp_enqueue_script( 'dokan-form-validate' );
wp_enqueue_script( 'speaking-url' );
wp_enqueue_script( 'dokan-vendor-registration' );
wp_enqueue_script( 'dokan-script' );
wp_enqueue_script( 'dokan-select2-js' );
}
}
do_action( 'dokan_enqueue_scripts' );
}
Then further down in that file its calling the dokan.js file I want to override...
'dokan-script' => array(
'src' => $asset_url . '/js/dokan.js',
'deps' => array( 'imgareaselect', 'customize-base', 'customize-model', 'dokan-i18n-jed' ),
'version' => filemtime( $asset_path . '/js/dokan.js' ),
),
Can someone help me as I'm not sure where to start or where to place my code?
Many Thanks,
Andrew
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window