Enhance doc regarding the doAction / applyFilters#40840
Enhance doc regarding the doAction / applyFilters#40840timotheemoulin wants to merge 1 commit intoWordPress:trunkfrom
Conversation
There is no documentation about the hookName, we need to know what kind of names are allowed. For example, slashes are not permitted in the hookName in the JS implementation, which is not a problem when registering PHP actions and filters (any string will do). The main issue is that registering an action/filter with a "wrong" name will not trigger any notice, thus not giving any indication on the source of the error.
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @timotheemoulin! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
| #### Parameters | ||
|
|
||
| - `hookName` unique name of the hook. It may contains only alphanumeric characters and dashes `[a-zA-z\-\_]`. Slashes are not permitted. | ||
| - `namespace` namespace used by your application. Needed only when adding or removing an action or a filter. |
There was a problem hiding this comment.
namespace is required, so I would change "Needed only..." to "Used..."
There was a problem hiding this comment.
"The namespace can only contain numbers, letters, dashes, periods, underscores and slashes." ... should take the vendor/plugin/function. (from inline docs)
|
|
||
| #### Parameters | ||
|
|
||
| - `hookName` unique name of the hook. It may contains only alphanumeric characters and dashes `[a-zA-z\-\_]`. Slashes are not permitted. |
There was a problem hiding this comment.
hook name from doc block: Should be a non empty string containing only numbers, letters, dashes, periods and underscores. Also, the hook name cannot begin with __.
|
This looks to be still relevant. The patch needs to be refreshed and feedback addressed. Marking as "stale" for now. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Enhance the documentation with missing (IMO important) info on the hook names.
There is no documentation about the hookName, we need to know what kind of names are allowed.
For example, slashes (
/) are not permitted in the hookName in the JS implementation, which is not a problem when registering PHP actions and filters (any string will do).Why?
The main issue is that registering an action/filter with a "wrong" name will not trigger any notice, thus not giving any indication on the source of the error, so improving the doc is a must have.