Marks a deprecated action or filter hook as deprecated and throws a notice.
Description
See also
Parameters
- $hook
-
(string) (Required) The hook that was used.
- $version
-
(string) (Required) The version of the plugin that deprecated the hook.
- $replacement
-
(string) (Optional) The hook that should have been used.
Default value: null
- $message
-
(string) (Optional) A message regarding the change.
Default value: null
Source
File: src/error-handler.php
public function deprecated_hook( $hook, $version, $replacement = null, $message = null ) { do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message ); if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) { $message = empty( $message ) ? '' : ' ' . $message; if ( ! is_null( $replacement ) ) { $message = sprintf( $this->get_translation( 'deprecated_hook' ), $hook, $version, $replacement ) . $message; } else { $message = sprintf( $this->get_translation( 'deprecated_hook_no_alt' ), $hook, $version ) . $message; } torro()->logger()->debug( $message, array( 'deprecated' => true ) ); } }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |