There are several ways to use filters and action hooks in WordPress. Probably the most common way is to copy a code snippet into your theme’s
This has a major flaw though: If you update your theme, those changes will most likely be lost. You would have to go back in to re-apply your adjustments.
By creating your own plugin, which contains the filters and action hooks, you are free to update your theme without the fear of loosing anything.
Creating a plugin sounds daunting for most non-programmers, but we got you covered.
We made it as simple as possible, by providing a plugin template, that you can use and it already contains all the filters/hooks that you can use in picu.
Let’s get you set up:
- Locate the file
- Copy the file into
wp-content/pluginsand rename it to
- You will now see a new plugin called “My picu” in your WordPress Admin under “Plugins”. Activate that plugin.
As of now, it doesn’t do anything yet, because all the relevant code parts are commented out, which means they are not active.
To activate a filter, you have to remove the double slashes (
//) in front of the respective line of code.
Please be careful. Playing around with code has the potential of crashing your website. If you have made a mistake that renders your website unresponsive (eg. error message or white screen), rename the
my-picu.php inside the
wp-content/plugins folder to something like
_my-picu.php. This way, WordPress will no longer execute the plugin and your site will be back up and running.
You can now start fixing your code or you can copy the template file as described above again, to start from scratch.
Also: always make sure that you’ve made a backup before you make any changes.
Still having issues?
In your WordPress Admin go to picu > Settings > Debug Info and send the contents of this page and your questions to email@example.com.