Documentation, Reference Materials, and Tutorials for WPCode
Do you ever find yourself wondering where a certain script on your WordPress site is coming from?
In this article, we will walk you through the easy steps you can take to find the source of a script, if it’s coming from WPCode and where in WPCode you can edit it.
A common reason for tracking down a script on your page has to do with running a performance audit. Often times, when you run performance tests on your site, the tools you are using will indicate that some scripts are slowing down your page load times. The suggested solution may be to remove the script or change where or how it is loaded. But, in order to do that, you first have to find where the scripts being loaded from.
By default, WPCode will not load any scripts on your frontend when you are not logged-in with the exception of using the WPCode Conversion Pixels addon. So you can easily rule that out, if you are not using the Conversion Pixels addon, there should be no script loaded by WPCode on your site when visiting the site as a regular user (not an administrator).
With that out of the way, of course, WPCode may be used to add many of your scripts to the site using either Code Snippets, the Global Header & Footer area or Page Scripts for individual pages/posts.
The easiest way to determine if the script is being added to the page using WPCode is to temporarily deactivate the WPCode plugin.
To do that you have to go to your site’s wp-admin area in the Plugins page look for the WPCode plugin and click on “Deactivate”. Don’t worry, none of your settings or scripts will be affected by this in any way.
With the plugin disabled if you still see the script on the page – the source of the script is not WPCode so at this point we could only guess where it’s coming from.
If after following the steps above you realise the script is actually coming from WPCode, you should be able to easily track it down using the WPCode Admin Bar Code Spotter Menu item as shown in the image above.
Make sure you are using a version of WPCode above 2.1 where the Code Spotter menu was added. If not, please update to the latest version of the plugin.
If you still can’t see the admin bar menu for WPCode, please make sure the menu is not disabled from the WPCode Settings page.
Now, using the Code Spotter menu you can easily track down all the scripts loaded on a page whether they are coming from the Global Header, the Page Scripts option or they are added using a snippet. Each item in the Admin Bar Code Spotter can be clicked and it will take you right to the source where you can look for the script you are trying to find.
The only thing left now is to either edit or remove the script based on what you want to accomplish.
Future-proof your website with WPCode Snippets and improve the way you manage code across all your websites.