Skip to content

Using sanitation filters and methods

nadavrt edited this page May 28, 2015 · 8 revisions

Creating Custom Sanitation Filters/Methods

In simple Meta Boxes creating a filter is as easy as creating a new method in sanitation-methods.php. There are three important rules when creating a new sanitation method:

  1. The name of the method must begin with sanitize_ because SMB uses this prefix to index its sanitation methods when it is instantiated.
  2. The method must accept a parameter that will hold the data to be sanitized (usually refered to as $data). SMB will automatically pass the required data to this parameter.
  3. The method must return the sanitized data, or else the data will be lost.

Clone this wiki locally