Skip to content

Conversation

DrewAPicture
Copy link
Member

@DrewAPicture DrewAPicture commented Jun 11, 2016

There is a proposal up for handling hook deprecation in WordPress core in 4.6+. It introduces three new functions, apply_filters_deprecated(), do_action_deprecated() and the _deprecated_hook() utility function, all of which we need to add handling for in the parser.

Background:
Implementation of hook deprecation is essentially a three-prong project in that we need to:

  1. Update core – #10411
  2. Update the parser
  3. Update the wporg-developer theme used on the code reference – #1766

Thankfully, the parser is flexible enough already that we don't need to do much to handle deprecated hooks!

Hooks would be deprecated by switching to corresponding apply_filters|do_action_deprecated() calls and signatures. Then – just like is already done with functions and methods – pairs of @deprecated and @see tags will be added to the hook DocBlocks so all deprecate-able elements are handled the same way from a documentation perspective.

Proposed Changes:
In this PR I've made the following changes:

  • Added apply_filters_deprecated and do_action_deprecated to the list of functions recognized as "hook" functions
  • Introduced two new hook types for use by themes: filter_deprecated and action_deprecated. These would be in addition the four existing types: filter, filter_reference, action, and action_reference, used to identify apply_filters(), apply_filters_ref_array(), do_action(), and do_action_ref_array(), respectively.
  • Added handling for the new _deprecated_hook() function in storing the version the hook was deprecated
  • Added a new function (and generic hook), WP_Parser\is_deprecated() which can be used for any parsed post type. WP_Parser\is_function_deprecated() has been converted into a wrapper for it, and its namesake filter, wp_parser_is_function_deprecated, retained for back-compat .

DrewAPicture added 4 commits June 11, 2016 13:24
…urrent element is deprecated.

Also converts is_function_deprecated() into a wrapper for the new function and introduces a new generic 'wp_parser_is_deprecated' hook. The 'wp_parser_is_function_deprecated' hook is retained for back-compat on the return of is_function_deprecated().
@DrewAPicture DrewAPicture merged commit d49f8eb into WordPress:master Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant