Code snippets improve WordPress functionality

Never heard of WordPress code snippets? They are little pieces of code designed to add functionality to a WordPress website. Typically, developers place snippets in the functions.php or wp-config.php files of the active theme (another reason to use a child theme). Check out these popular snippets and see if you need their functionality for your website.

Thousands of code snippets available

There are literally thousands of snippets available. You install them by manually editing your functions.php or wp-config.php files. You can also use a plugin to add snippets. Pay attention when you are copying and pasting snippets from websites because sometimes web servers change the single and double quotes for standardized printing. If a snippet does not work or breaks your website, then check for incorrect quotation marks. Always test snippets first.

WordPress saves post revisions in the database for easy roll back to an earlier version. These revisions add up over time causing your database to bloat. Do you want to limit the number of post revisions WordPress saves to the database? Use this snippet:

define('WP_POST_REVISIONS', 5); // Number of post revisions saved

These little snippets add functionality to your WordPress website. They are compact and precise. When looking for a certain functionality for your website, check to see if there is a snippet available using your favourite search engine.