WordPress remove_filter() Function

Beginner
6 min read
Updated: Nov 2026
3 examples
Filter hook

Definition

In WordPress, remove_filter() takes a function off a filter hook. It undoes a previous add_filter(), so the value is no longer changed by that function.

A popular use is to turn off a built-in filter, such as wpautop, which adds paragraph tags to post content. The rules are the same as remove_action(): use the same hook name, the same callback, and the same priority that were used to add it.

Syntax

Use the same values you used in add_filter().

WordPress
<?php remove_filter( 'the_content', 'wpautop' ); ?>
CallWhat it does
remove_filter( 'the_content', 'wpautop' )Stop WordPress from adding paragraph tags to post content.
remove_filter( 'the_title', 'my_title', 15 )Remove a function that was added with priority 15.
remove_filter( 'the_content', array( $obj, 'note' ) )Remove a method of a class object.

remove_filter() does nothing if the function is not found, so it is safe to call.

Full declaration
WordPress
remove_filter( string $hook_name, callable|string|array $callback, int $priority = 10 ): bool

Parameters

ParameterDescription
$hook_namestring. The filter hook the function is attached to.
$callbackcallable. The function to remove. For a class method, use the same array that was used to add it.
$priorityint. The priority used when it was added. Default is 10. It must match exactly, or the function stays.

Return Value

Return ValueDescription
booltrue if the function was found and removed. false if nothing matched.

WordPress Examples

Three short examples. Each one shows the code and what it prints or does.

Example 1 — Turn off automatic paragraphs

Remove the built-in wpautop filter from the post content.

WordPress
remove_filter( 'the_content', 'wpautop' );

How It Works

  1. WordPress core adds wpautop to the_content with the default priority 10.
  2. remove_filter() matches it and removes it.
  3. Post content is no longer wrapped in paragraph tags automatically. You must write your own HTML.

Example 2 — Remove your own filter

Add a filter, see the result, remove it, and see the result again.

WordPress
function ctf_shout_title( $title ) {
  return strtoupper( $title );
}
add_filter( 'the_title', 'ctf_shout_title', 15 );
echo apply_filters( 'the_title', 'hello' ) . "\n";

remove_filter( 'the_title', 'ctf_shout_title', 15 );
echo apply_filters( 'the_title', 'hello' );

How It Works

  1. The filter was added with priority 15, so it turns the title into upper case.
  2. remove_filter() uses the same hook, callback, and priority 15.
  3. After removal, the same call returns the original text.

Example 3 — Remove a filter on one page

Remove a filter only when a condition is true. Do it on a hook that runs before the content is shown.

WordPress
function ctf_landing_no_autop() {
  if ( is_page( 'landing' ) ) {
    remove_filter( 'the_content', 'wpautop' );
  }
}
add_action( 'template_redirect', 'ctf_landing_no_autop' );

How It Works

  1. template_redirect runs before WordPress loads the template, so the page is already known.
  2. is_page( 'landing' ) checks that we are on the landing page.
  3. Only then do we remove wpautop. Other pages keep the default filter.

Frequently Asked Questions

It removes a function that was added to a filter hook with add_filter(), so it no longer changes the value.
Nothing matched. The hook name, the callback, or the priority is different, or the filter was not added yet.
Use remove_filter( 'the_content', 'wpautop' ). You can also remove it for excerpts with remove_filter( 'the_excerpt', 'wpautop' ).
Yes. Call remove_filter() inside a function hooked to template_redirect or wp, and check the page with a conditional tag.
They work the same way. remove_filter() is for filter hooks and remove_action() is for action hooks.

Back to the Function Index

See all six hooks functions in one table and pick what to learn next.

Hooks Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful