Obtenez une liste de toutes les actions enregistrées
2 réponses
- votes
-
- 2013-07-02
Lesfiltreset les actions sonttous deux affectés à des hooks.Lesfonctions attribuées aux hooks sont stockées dans la variableglobale
$wp_filter
.Ilne vous resteplus qu'à l 'print_r
.print_r($GLOBALS['wp_filter']);
PS.Lafonction
add_action
effectue un appeladd_filter
.Et ce dernierfait$wp_filter[$tag][$priority][$idx]
.
NOTE: vouspouvez directement ajouter ce code dansfunctions.php,et vous verrez un débogage sur votre site:
add_action('wp', function(){ echo '<pre>';print_r($GLOBALS['wp_filter']); echo '</pre>';exit; } );
Filters and actions are both assigned to hooks. Functions assigned to hooks are stored in global
$wp_filter
variable. So all you have to do is toprint_r
it.print_r($GLOBALS['wp_filter']);
PS.
add_action
function makes aadd_filter
call. And the latter does$wp_filter[$tag][$priority][$idx]
.
NOTE: you can directly add this code in functions.php, and you will see a debug on your site:
add_action('wp', function(){ echo '<pre>';print_r($GLOBALS['wp_filter']); echo '</pre>';exit; } );
-
sympa,mais oùpuis-je les déboguer?j'aiessayé d'ajouter if (WP_DEBUG==true) { global $ wp_filter; print_r ($ wp_filter); } dansindex.phpnadj'ai NULLnice, but where can i debug them? i tried to add if(WP_DEBUG == true){ global $wp_filter; print_r($wp_filter); } in index.php nad i got NULL
- 0
- 2013-07-02
- Jacer Omri
-
monmauvais,ne devraitpas écrireglobal $ wp_filter;my bad, shouldn't write global $wp_filter;
- 0
- 2013-07-02
- Jacer Omri
-
OK,alors vous avez résolu ça?OK, so you worked that out?
- 0
- 2013-07-02
- Krzysiek Dróżdż
-
- 2020-06-23
Utilisez cepluginpour afficher visuellement sur unepage https://wordpress.org/plugins/show-hooks/
Use this plugin to show visually on a page https://wordpress.org/plugins/show-hooks/
J'essaye de déboguer unplugin queje n'aipas développéet je veux listertoutes les actionsenregistrées.J'ai lu cefil SO:
Mais c'est spécifique à un hooket il s'agit defiltres,pas d'actions.
Existe-t-il une variable comme
$wp_filter
ou quelque chose?