I also had such problem. But I have figured out how to fix this.
You need to find file smart-watermark.php, open it, locate ‘options_enqueue_scripts’ public function.
Then this:
public function options_enqueue_scripts() {
wp_register_script(
'smart-watermark-settings-general',
plugins_url('js/smart-watermark-settings-general.js', __FILE__),
array('jquery', 'media-upload', 'thickbox')
);
wp_register_script(
'smart-watermark-settings-bulk',
plugins_url('js/smart-watermark-settings-bulk.js', __FILE__),
array('jquery', 'media-upload', 'thickbox')
);
switch ($this->_get_current_settings_tab()) {
case self::SETTINGS_KEY_GENERAL:
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('smart-watermark-settings-general');
break;
case self::SETTINGS_KEY_BULK:
wp_enqueue_script('jquery');
wp_enqueue_script('smart-watermark-settings-bulk');
wp_localize_script('jquery', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
break;
}
}
replace with this:
public function options_enqueue_scripts( $hook ) {
if( 'settings_page_smart_watermark_options' != $hook )
return;
wp_register_script(
'smart-watermark-settings-general',
plugins_url('js/smart-watermark-settings-general.js', __FILE__),
array('jquery', 'media-upload', 'thickbox')
);
wp_register_script(
'smart-watermark-settings-bulk',
plugins_url('js/smart-watermark-settings-bulk.js', __FILE__),
array('jquery', 'media-upload', 'thickbox')
);
switch ($this->_get_current_settings_tab()) {
case self::SETTINGS_KEY_GENERAL:
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('smart-watermark-settings-general');
break;
case self::SETTINGS_KEY_BULK:
wp_enqueue_script('jquery');
wp_enqueue_script('smart-watermark-settings-bulk');
wp_localize_script('jquery', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
break;
}
}
You are done!)
It is a very simple fix. All I want to do is to target scripts enqueue to certain admin page (in this case just for plugin’s admin page but not for entire admin area).
Thanks for the solution. I’ll add this to the next release.