Media upload error in wordpress after installation of customized plugin
After installation of custom plugin in wordpress sometimes error occurs while media upload.
The reason is you have may be you have included '$' in js of plugin(replace $ with jQuery) or might be you have added js in plugin_name.php file.
To correct the error include your js of plugin in separate js file and put this file in plugin_name folder with plugin_name.php file.
And to use this js in plugin add the below function in plugin file.
function my_scripts_method() {
wp_enqueue_script(
'plugin_name',
plugins_url() . '/plugin_name/plugin_name.js',
array( 'jquery' )
);
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
Hope this will solve your problem :)
After installation of custom plugin in wordpress sometimes error occurs while media upload.
The reason is you have may be you have included '$' in js of plugin(replace $ with jQuery) or might be you have added js in plugin_name.php file.
To correct the error include your js of plugin in separate js file and put this file in plugin_name folder with plugin_name.php file.
And to use this js in plugin add the below function in plugin file.
function my_scripts_method() {
wp_enqueue_script(
'plugin_name',
plugins_url() . '/plugin_name/plugin_name.js',
array( 'jquery' )
);
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
Hope this will solve your problem :)
No comments:
Post a Comment