WooCommerce Code Reference

WC_Deprecated_Hooks
in package

WC_Deprecated_Hooks class maps old actions and filters to new ones. This is the base class for handling those deprecated hooks.

Based on the WCS_Hook_Deprecator class by Prospress.

Table of Contents

$deprecated_hooks  : array
Array of deprecated hooks we need to handle.
$deprecated_version  : array
Array of versions on each hook has been deprecated.
__construct()  : mixed
Constructor.
get_old_hooks()  : array
Get old hooks to map to new hook.
handle_deprecated_hook()  : mixed
If the old hook is in-use, trigger it.
hook_in()  : mixed
Hook into the new hook so we can handle deprecated hooks once fired.
maybe_handle_deprecated_hook()  : mixed
If the hook is Deprecated, call the old hooks here.
display_notice()  : mixed
Display a deprecated notice for old hooks.
get_deprecated_version()  : string
Get deprecated version.
trigger_hook()  : mixed
Fire off a legacy hook with it's args.

Properties

Methods

handle_deprecated_hook()

If the old hook is in-use, trigger it.

public abstract handle_deprecated_hook(string $new_hook, string $old_hook, array $new_callback_args, mixed $return_value) : mixed
Parameters
$new_hook : string

New hook name.

$old_hook : string

Old hook name.

$new_callback_args : array

New callback args.

$return_value : mixed

Returned value.

Return values
mixed

display_notice()

Display a deprecated notice for old hooks.

protected display_notice(string $old_hook, string $new_hook) : mixed
Parameters
$old_hook : string

Old hook.

$new_hook : string

New hook.

Return values
mixed

trigger_hook()

Fire off a legacy hook with it's args.

protected abstract trigger_hook(string $old_hook, array $new_callback_args) : mixed
Parameters
$old_hook : string

Old hook name.

$new_callback_args : array

New callback args.

Return values
mixed