[wp-trac] [WordPress Trac] #40568: Add an action in WP_Error::add()

WordPress Trac noreply at wordpress.org
Fri Sep 11 20:53:09 UTC 2020


#40568: Add an action in WP_Error::add()
------------------------------------+--------------------------
 Reporter:  Shelob9                 |       Owner:  johnbillion
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  5.6
Component:  General                 |     Version:  2.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+--------------------------

Comment (by TimothyBlynJacobs):

 > Hooks aren't free of course, but there are plenty of hooks that can fire
 hundreds of times during a request, eg. esc_html, gettext, and
 map_meta_cap. This isn't a reason to avoid introducing useful new hooks.

 For sure. Maybe a big banner in the hook description is enough to warn
 developers about potential misuse.

 For numbers purposes, this is what I get in a batch REST API request to
 the menus endpoint.

 {{{
 {
   "get_post_metadata": 53118,
   "gettext": 15086,
   "gettext_default": 9366,
   "check_wp_error": 8928,
   "gettext_gutenberg": 5688,
   "query": 3754,
   "log_query_custom_data": 3754,
   "gettext_with_context": 3352,
   "gettext_with_context_default": 3317,
   "get_nav_menu": 3018,
   "get_term": 3018,
   "wp_setup_nav_menu_item": 2796,
   "wp_trim_words": 2772,
   "nav_menu_attr_title": 2772,
   "nav_menu_description": 2772,
   "rest_request_parameter_order": 2192,
   "alloptions": 1933,
   "sanitize_key": 1155,
   "pre_get_col_charset": 964,
   "set_url_scheme": 765,
   "option_home": 674,
   "pre_option_home": 674,
   "home_url": 673,
   "option_permalink_structure": 609,
   "pre_option_permalink_structure": 609,
   "rest_url_prefix": 578,
   "rest_url": 574,
   "get_object_subtype_post": 432,
   "map_meta_cap": 293,
   "update_post_metadata_cache": 265,
   "user_has_cap": 245,
   "update_post_metadata": 216,
   "added_post_meta": 216,
   "add_post_meta": 216,
   "add_post_metadata": 216,
   "register_block_type_args": 130,
   "default_post_metadata": 120,
   "clean_url": 115,
   "extra_plugin_headers": 110
 }
 }}}

 An aside, maybe we should implement a `get_metadata` filter that has the
 meta key in it 🙈

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40568#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list