WP_Hook::remove_filter()
Removes a callback function from a filter hook.
Метод класса: WP_Hook{}
Хуков нет.
Возвращает
true|false
. Whether the callback existed before it was removed.
Использование
$WP_Hook = new WP_Hook(); $WP_Hook->remove_filter( $hook_name, $callback, $priority );
- $hook_name(строка) (обязательный)
- The filter hook to which the function to be removed is hooked.
- $callback(callable|строка|массив) (обязательный)
- The callback to be removed from running when the filter is applied. This method can be called unconditionally to speculatively remove a callback that may or may not exist.
- $priority(int) (обязательный)
- The exact priority used when adding the original filter callback.
Список изменений
С версии 4.7.0 | Введена. |
Код WP_Hook::remove_filter() WP Hook::remove filter WP 6.7.1
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; }