[ WordPress.org  ](https://wordpress.org/)

  * [ News  ](https://wordpress.org/news/)
  * [ Showcase  ](https://wordpress.org/showcase/)
  * [ Hosting  ](https://wordpress.org/hosting/)
  * Extend 
    * [ Themes  ](https://wordpress.org/themes/)
    * [ Plugins  ](https://wordpress.org/plugins/)
    * [ Patterns  ](https://wordpress.org/patterns/)
    * [ Blocks  ](https://wordpress.org/blocks/)
    * [ Openverse  ↗  ︎  ](https://openverse.org/)
  * Learn 
    * [ Learn WordPress  ](https://learn.wordpress.org/)
    * [ Documentation  ](https://wordpress.org/documentation/)
    * [ Forums  ](https://wordpress.org/support/forums/)
    * [ Developers  ](https://developer.wordpress.org/)
    * [ WordPress.tv  ↗  ︎  ](https://wordpress.tv/)
  * Community 
    * [ Make WordPress  ](https://make.wordpress.org/)
    * [ Photo Directory  ](https://wordpress.org/photos/)
    * [ Five for the Future  ](https://wordpress.org/five-for-the-future/)
    * [ Events  ](https://events.wordpress.org/)
    * [ Job Board  ↗  ︎  ](https://jobs.wordpress.net/)
  * About 
    * [ About WordPress  ](https://wordpress.org/about/)
    * [ Enterprise  ](https://wordpress.org/enterprise/)
    * [ Gutenberg  ↗  ︎  ](https://wordpress.org/gutenberg/)
    * [ Swag Store  ↗  ︎  ](https://mercantile.wordpress.org/)
  * [ Get WordPress  ](https://wordpress.org/download/)

Search in WordPress.org

[ Get WordPress ](https://wordpress.org/download/)

[ WordPress.org  ](https://wordpress.org/)

[ WordPress Developer Resources ](https://developer.wordpress.org)

apply_filters()

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

[ Home ](https://developer.wordpress.org) [ Reference
](https://developer.wordpress.org/reference/) [ Functions
](https://developer.wordpress.org/reference/functions/) apply_filters()

Search

#  apply_filters(  string  $hook_name  ,  mixed  $value  ,  mixed  $args  ):
mixed

##  In this article

Table of Contents

  * Description 
  * Parameters 
  * Return 
  * Source 
  * Related 
  * Changelog 
  * User Contributed Notes 

↑  Back to top

Calls the callback functions that have been added to a filter hook.

##  Description

This function invokes all functions attached to filter hook ` $hook_name ` .  
It is possible to create new filter hooks by simply calling this function,
specifying the name of the new hook using the ` $hook_name ` parameter.

The function also allows for multiple additional arguments to be passed to
hooks.

Example usage:

    
    
    // The filter callback function.
    function example_callback( $string, $arg1, $arg2 ) {
        // (maybe) modify $string.
        return $string;
    }
    add_filter( 'example_filter', 'example_callback', 10, 3 );
    
    /*
     * Apply the filters by calling the 'example_callback()' function
     * that's hooked onto `example_filter` above.
     *
     * - 'example_filter' is the filter hook.
     * - 'filter me' is the value being filtered.
     * - $arg1 and $arg2 are the additional arguments passed to the callback.
    $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );

##  Parameters

` $hook_name ` string  required

    

The name of the filter hook.

` $value ` mixed  required

    

The value to filter.

` $args ` mixed  optional

    

Additional parameters to pass to the callback functions.

##  Return

mixed  The filtered value after all hooked functions are applied to it.

##  Source

    
    
    function apply_filters( $hook_name, $value, ...$args ) {
    	global $wp_filter, $wp_filters, $wp_current_filter;
    
    	if ( ! isset( $wp_filters[ $hook_name ] ) ) {
    		$wp_filters[ $hook_name