Adding functionalities in functions.php

A quick introduction

WordPress offers filter hooks to allow plugins to modify various types of internal data at runtime.

A plugin can modify data by binding a callback to a filter hook. When the filter is later applied, each bound callback is run in order of priority, and given the opportunity to modify a value by returning a new value.

The following example shows how a callback function is bound to a filter hook.

Note that $example is passed to the callback, (maybe) modified, then returned:

If you want to know more, before adding your first add_filter(), see the below source. If it’s your first time, see our collection of filters below.

Source: https://developer.wordpress.org/reference/functions/add_filter/

If you have never used add_filter() or other functions to modify .php files in your theme or plugin files. Please make sure you have a back-up of the file you’re modifying and quick access to your FTP to revert back if anything goes wrong.

Adding your filters with Must-Use Plugins. It’s really simple!

Adding filters and hooks for our plugin might look difficult, but it can be done quite easily. Copy/Paste the needed snippet below in your favourite text editor and follow the instructions in our article about MU Plugins.

When implementing the filters below in functions.php, make sure to remove the first <?php line. When using MU Plugins, this line can be left in place.

Our collection of prefilled add_filter

Join 1M+ users and install The Privacy Suite for WordPress locally, automated or fully customized, and access our awesome support if you need any help!

Complianz has received its Google CMP Certification to conform to requirements for publishers using Google advertising products.