October 22, 2020
An update in WP 5.6 is going to remove support for very old jQuery. I am a Senior Front End Developer for an agency that builds and supports over 40 WP sites a year. Our custom theme, Gesso, does not use older jQuery, but we do use a range of plugins based on the technical requirements of our clients. The jQuery version leap is quite large, and we are trying to account for all the plugins and different versions of these plugins that we use that may have flown under the radar utilizing now deprecated code.
We are currently using the jQuery Test Update plugin and jQuery Migrate on new builds, but we needed a more programmatic way to analyze sites that are currently deployed. First we want to get a comprehensive view of all the plugins we use and their versions. Then we are investigating the plugin code to determine if it uses old jQuery. If it does, we are either, updating that plugin’s version (see Custom Post UI), or taking it out completely if we can’t find a version that complies with the new requirement. Many of our clients are non-profit and government sites that are updated monthly. This WP update requires more rigor than usual, so we need a tool to help.
Enter PyGithub. PyGithub is a Python library that accesses the GitHub API. It allows you to run robust searches throughout all of your repos, when you need to do something more complicated than the GitHub search function will allow. I will demonstrate how to connect to the GitHub API and then drill down to the composer.json and pull out the plugin names and versions. Then I will show how to search within the code for offending jQuery.
I hope to have everyone using this simple tool to do all kinds of analysis on their WP repos, and provide people some confidence in updating sites to the latest version of WP without fear of breaking things. I will also cover some of the typical issues that we ran into regarding plugins, and older theme code.