[wp-trac] [WordPress Trac] #42698: Dynamic Hooks that use REQUEST / GET / POST variables
WordPress Trac
noreply at wordpress.org
Sat Nov 25 17:49:44 UTC 2017
#42698: Dynamic Hooks that use REQUEST / GET / POST variables
-------------------------------+-----------------------------
Reporter: ramiy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: docs, performance |
-------------------------------+-----------------------------
The background for this ticket is naming-convention for
[https://developer.wordpress.org/?s=%7B&post_type%5B%5D=wp-parser-hook
dynamic hooks] set in ticket #37748 and in the
[https://make.wordpress.org/core/handbook/best-practices/coding-
standards/php/#interpolation-for-naming-dynamic-hooks Coding Standards
Best Practices].
WordPress core has
[https://developer.wordpress.org/?s=%24_&post_type%5B%5D=wp-parser-hook 5
hooks] that don't implement those best practices, hooks that use
'''$_REQUEST''', '''$_GET''' and '''$_POST''' variables as parameters in
their names.
----
The attached patch fixes those hooks, replacing:
`do_action( 'network_admin_edit_' . $_GET['action'] );`
with:
`do_action( "network_admin_edit_{$action}" );`
----
Note that the change has other benefits like affecting the code reference
slugs:
* https://developer.wordpress.org/reference/hooks/wp_ajax__requestaction/
*
https://developer.wordpress.org/reference/hooks/admin_action__requestaction/
*
https://developer.wordpress.org/reference/hooks/network_admin_edit__getaction/
*
https://developer.wordpress.org/reference/hooks/wp_ajax_nopriv__requestaction/
*
https://developer.wordpress.org/reference/hooks/network_sites_updated_message__getupdated/
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42698>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list