On this page
apply_filters_deprecated( string $hook_name, array $args, string $version, string $replacement = '', string $message = '' )
Fires functions attached to a deprecated filter hook.
Description
When a filter hook is deprecated, the apply_filters() call is replaced with apply_filters_deprecated() , which triggers a deprecation notice and then fires the original filter hook.
Note: the value and extra arguments passed to the original apply_filters() call must be passed here to $args as an array. For example:
// Old filter.
return apply_filters( 'wpdocs_filter', $value, $extra_arg );
// Deprecated.
return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' );
See also
Parameters
$hook_namestring Required-
The name of the filter hook.
$argsarray Required-
Array of additional function arguments to be passed to apply_filters() .
More Arguments from apply_filters( ... $args )
Additional parameters to pass to the callback functions. $versionstring Required-
The version of WordPress that deprecated the hook.
$replacementstring Optional-
The hook that should have been used.
Default:
'' $messagestring Optional-
A message regarding the change.
Default:
''
Source
File: wp-includes/plugin.php. View all references
function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
if ( ! has_filter( $hook_name ) ) {
return $args[0];
}
_deprecated_hook( $hook_name, $version, $replacement, $message );
return apply_filters_ref_array( $hook_name, $args );
}
Related
Uses
| Uses | Description |
|---|---|
| _deprecated_hook() wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. |
| has_filter() wp-includes/plugin.php | Checks if any filter has been registered for a hook. |
| apply_filters_ref_array() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook, specifying arguments in an array. |
Used By
| Used By | Description |
|---|---|
| get_block_editor_settings() wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. |
| block_editor_rest_api_preload() wp-includes/block-editor.php | Preloads common data used with the block editor by specifying an array of REST API paths that will be preloaded for a given block editor context. |
| get_allowed_block_types() wp-includes/block-editor.php | Gets the list of allowed block types to use in the block editor. |
| get_block_categories() wp-includes/block-editor.php | Returns all the categories for block types that will be shown in the block editor. |
| _wp_privacy_send_request_confirmation_notification() wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| _wp_privacy_send_erasure_fulfillment_notification() wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| WP_Privacy_Policy_Content::get_default_content() wp-admin/includes/class-wp-privacy-policy-content.php | Return the default suggested privacy policy content. |
| WP_Site::get_details() wp-includes/class-wp-site.php | Retrieves the details for this site. |
| WP_REST_Server::serve_request() wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
| login_header() wp-login.php | Output the login page header. |
| validate_another_blog_signup() wp-signup.php | Validates a new site sign-up for an existing user. |
| WP_Screen::render_screen_meta() wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
| wp_save_image_file() wp-admin/includes/image-edit.php | Saves image to file. |
| image_edit_apply_changes() wp-admin/includes/image-edit.php | Performs group of changes on Editor specified. |
| wp_stream_image() wp-admin/includes/image-edit.php | Streams image in WP_Image_Editor to browser. |
| media_buttons() wp-admin/includes/media.php | Adds the media button to the editor. |
| WP_Terms_List_Table::prepare_items() wp-admin/includes/class-wp-terms-list-table.php | |
| map_meta_cap() wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| WP::build_query_string() wp-includes/class-wp.php | Sets the query string property based off of the query variable property. |
| get_posts_by_author_sql() wp-includes/post.php | Retrieves the post SQL based on capability, author, and type. |
| WP_Rewrite::mod_rewrite_rules() wp-includes/class-wp-rewrite.php | Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess. |
| WP_Rewrite::rewrite_rules() wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from permalink structure. |
| get_blog_details() wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| _WP_Editors::editor() wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/apply_filters_deprecated