I use a few premium WordPress plugins regularly as part of my work. Rather than rely on keeping the licence key in the database (via the relevant plugin’s WordPress admin settings screen), I generally prefer to add the licence key as a constant to a (non git committed) wp-config.php file.
This way I don’t have to worry about if the licence key got lost when I pushed or pulled from a different development environment, when I use my preferred tool for doing this WP Migrate DB.
Right now there are four plugins that I use on a regular basis that support this method of defining a constant:
To use this method simply add the following to your wp-config.php file (you’ll need to do this on each environment – developer, staging or production – you plan to use this on) and you’re good to go. (If you use version control, I don’t recommend you commit you licence key however).
If you know of any other good premium plugins that support this method me know and I’ll add them here.
Once you start developing more with WordPress you’ll probably find yourself using
add_filterto add, modify or remove data.
When modifying some text you might do something like the following simple example.
Sometimes you’ll want to remove text too.
However, you might not be aware (or might forget!) that there’s a shorter way of doing this.
In the above example, there’s no need to write out a separate function to achieve the result that you want. Instead you can use one of the following (self explanatory) ‘shortcut’ functions, baked into WordPress, to pass the type of data that you want.
Writing it out this way is not only shorter, but much easier to read too.