Removes a callback function from a filter hook.
$hook_namestringrequired
$callbackcallable|string|arrayrequired
$priorityintrequired
public function remove_filter( $hook_name, $callback, $priority ) {
$function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
$exists = isset( $this->callbacks[ $priority ][ $function_key ] );
if ( $exists ) {
unset( $this->callbacks[ $priority ][ $function_key ] );
if ( ! $this->callbacks[ $priority ] ) {
unset( $this->callbacks[ $priority ] );
$this->priorities = array_keys( $this->callbacks );
if ( $this->nesting_level > 0 ) {
$this->resort_active_iterations();
}
}
}
return $exists;
}
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_hook/remove_filter