- When you "hook"/
add_action/*_filter('whatever'); a callback function to
do_action('whatever');, then you basically add the function (or object-method) name to the
Doing so, you add the function/method name to an array that is built like the following
$wp_filter[ $tag ][ $priority ][ $idx ]
// $tag = action/filter name
// $priority = 3rd argument / execution order
// $idx = "unique" name
- Not the 3rd argument/
$idx is built using the
_wp_filter_build_unique_id() function, that takes the first args from
- Inside this function, every function name stays the same, only method names change. This is the reason, why you often find "funky" method names, prefixed with a pretty long number.
Can I add numbers after letters in do_action tag?
So yes, numbers are completely valid when naming action hooks. Summed up, it's save to use
a-zA-Z0-9_ as function/method/variable names.
- is not supported. And while some characters might work well on your system, it mostly depends on the encoding if your chosen function name (example:
_wUT?a_nice_DÄY!()) works or not. WordPress itself does not check if a function/var/hook/filter/whatever name is valid or not.
Addition to @BrianFegter answer about "contextual hooks".
You can see some "contextual hooks", when you take a look at the »help«-panel in (any) screen in your (MU or single) installation, using this plugin1).
1) Plugin inspired by @StephenHarris article.