I mentioned in my post, “Safely adding code to WordPress” that you can add code to WordPress plugins, themes and even the core, without altering core functionality. That’s done using action and filter hooks, as explained in that post.
Sometimes it’s not easy to find those hooks. So here’s a guide on how to find them quickly using the free and cross-platform Atom editor.
To search for hooks in a plugin, download the plugin .zip file that you’d like to search through. I mentioned MarketPress in the walkthrough video, you can use any plugin though.
Extract the plugin’s .zip file on your hard drive, then go into the extracted folder and open one of the files in Atom.
Then pressto open the Find/Replace panel.
Enter “do_action” if you’d like to find action hooks, or “apply_filters” if you’d like to find filter hooks. Then press ENTER to commence the search. You’ll see a new panel full of search results.
Simply click any of the items in the search results panel and Atom will open the file and take you to the respective line of code.
Simplifying the search
The Minimap package (I often call them plugins) for Atom makes searches much easier. Just install it through the built-in installer in Atom. Press to open the settings panel, then click on Install. Type ‘minimap‘ in the search bar and click the Install button for the respective packages.
Please feel free to ask if you have any questions about all this.