Visual Composer JS error, cause of custom JS include in WordPress backend

This happens to me often, because many people use the visual composer plugin to edit their content in a fast way. As a developer you write some awesome backend plugin with many options and stuff and try to make it look awesome and userfriendly and the activation of the plugin fucks up the VC config. There is an easy – but a bit dirty – way to deal with that. WP has an awesome function wherewith you can easily see on which page you are. Just call get_current_screen() and you can seperate by the base param of the result.

In combination with the wp_enqueue_script sections of your plugin, you will be able to only load the js file on that one page where it is necessary.

Example:

 

Felix

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.