Où puis-je trouver une liste de hooks WordPress?
-
-
C'estmon site deprédilection lorsqueje recherche desinformations sur les hooks ... [WordPress Hooks Database] (http://adambrown.info/p/wp_hooks)This is my go-to site when I'm looking for hook info... [WordPress Hooks Database](http://adambrown.info/p/wp_hooks)
- 0
- 2010-08-13
- Keith S.
-
WordPress aenfin [documentétous ses hooks] (https://developer.wordpress.org/reference/hooks/).: D Vouspouvez yparcouriret rechercher.WordPress has finally [documented all its hooks](https://developer.wordpress.org/reference/hooks/). :D You can browse and search there.
- 1
- 2014-11-21
- sam
-
6 réponses
- votes
-
- 2012-05-22
Plug-in Debug Bar Action Hooks
Affiche une liste des actions déclenchéespour la demandeen cours.Nécessite leplugin de labarre de débogage.
Displays a list of actions fired for the current request. Requires the debug bar plugin.
-
Ilexiste également [Addon des actionset filtres de labarre de débogage] (http://wordpress.org/plugins/debug-bar-actions-and-filters-addon/)et [Journal de crochet de labarre de débogage] (http://wordpress.org/plugins/debug-bar-hook-log/).There’s also [Debug Bar Actions and Filters Addon](http://wordpress.org/plugins/debug-bar-actions-and-filters-addon/) and [Debug Bar Hook Log](http://wordpress.org/plugins/debug-bar-hook-log/).
- 2
- 2013-07-28
- Synetech
-
- 2010-08-13
Le Codex a une Référence d'action et un Référence dufiltre . Adam Brown a créé une base de données de hook qui contienttous les hooks dans le code source,et ajoute la documentation despages wiki,informations de versionet liens vers le code source. Vouspouvez l'amélioreren écrivant de la documentation dans le Codex.
Bien sûr,certains hooks sont dynamiques,en fonction d'autres données. Prenez le
wp_transition_post_status
fonction:function wp_transition_post_status($new_status, $old_status, $post) { do_action('transition_post_status', $new_status, $old_status, $post); do_action("${old_status}_to_$new_status", $post); do_action("${new_status}_$post->post_type", $post->ID, $post); }
Si vousenregistrez un
event
detype depublicationpersonnaliséet un statut depublicationpersonnalisécancelled
,vous aurez un crochet d'actioncancelled_event
.The Codex has an Action Reference and a Filter Reference. Adam Brown created a hook database that has all hooks in the source code, and adds the documentation from the wiki pages, version information and links to the source code. You can improve it by writing documentation in the Codex.
Of course, some hooks are dynamic, depending on other data. Take the
wp_transition_post_status
function:function wp_transition_post_status($new_status, $old_status, $post) { do_action('transition_post_status', $new_status, $old_status, $post); do_action("${old_status}_to_$new_status", $post); do_action("${new_status}_$post->post_type", $post->ID, $post); }
If you register a custom post type
event
and a custom post statuscancelled
, you will have acancelled_event
action hook.-
Labase de données Adam Brownsn'estpas seulement une combinaison de ces 2pages,elle contienttoutes les actionset tous lesfiltres de WordPress répertoriés.Oun'est-cepas ce que vous vouliez dire.Adam Browns database is not just a combination of those 2 pages, it has every single action and filter in WordPress listed. Or is that not what you meant.
- 0
- 2010-08-13
- Arlen Beiler
-
@Arlen: Ouien effet,je l'ai réécritpour que ce soitplus clair.@Arlen: Yes indeed, I rewrote it so that is more clear.
- 0
- 2010-08-13
- Jan Fabry
-
- 2010-08-18
Bien queprimitif,ce code depluginpeutpeut-être vous aider? Remplacez "add_action"par "add_filter" si vous souhaitezplutôt regarder lesfiltres. Chargez lepluginpuis actualisez lapage d'accueil du site. Unefois chargé,ilesttrès difficile de le désactiver,alors renommez simplement lefichier duplugin dans le dossierpluginset actualisez ànouveau le site -il se désactivera automatiquement. J'ai utilisé cette astuce àmaintes reprisespour résoudre desproblèmes outrouver unendroit oùje peuxinsérer quelque chose.
<?php /* Plugin Name: Hooks Plugin URI: http://example.com/ Description: Hooks Version: 1.00 Author: Hooks Author URI: http://example.com/ */ add_action('all','hook_catchall'); function hook_catchall(&$s1 = '', &$s2 = '', &$s3 = '', &$s4 = '') { echo "<h1>1</h1>\n"; print_r($s1); echo "<br />\n"; echo "<h1>2</h1>\n"; print_r($s2); echo "<br />\n"; echo "<h1>3</h1>\n"; print_r($s3); echo "<br />\n"; echo "<h1>4</h1>\n"; print_r($s4); echo "<br />\n"; return $s1; }
Although primitive, perhaps this plugin code can help? Switch "add_action" with "add_filter" if you want to look at filters instead. Load the plugin and then refresh the homepage of the site. Once loaded, it's a serious pain to deactivate, so just rename the plugin file under the plugins folder and refresh the site again -- it will deactivate automatically. I've used this trick many a time to troubleshoot things or find a place where I can insert something.
<?php /* Plugin Name: Hooks Plugin URI: http://example.com/ Description: Hooks Version: 1.00 Author: Hooks Author URI: http://example.com/ */ add_action('all','hook_catchall'); function hook_catchall(&$s1 = '', &$s2 = '', &$s3 = '', &$s4 = '') { echo "<h1>1</h1>\n"; print_r($s1); echo "<br />\n"; echo "<h1>2</h1>\n"; print_r($s2); echo "<br />\n"; echo "<h1>3</h1>\n"; print_r($s3); echo "<br />\n"; echo "<h1>4</h1>\n"; print_r($s4); echo "<br />\n"; return $s1; }
-
Cen'estpeut-êtrepasjoli,mais celapourraiten fait être lemoyen leplus rapideet leplus simple dans certains scénarios (j'utilise souvent le «débogageprintf»pour corriger depetites choses dans depetitsprojets Notepad +en ligne de commande au lieu d'utiliser un IDEentier).It may not be pretty, but it might actually be the quickest and easiest way in some scenarios (I often use “printf debugging” to fix little things in small, Notepad+command-line projects instead of using a whole IDE).
- 0
- 2013-07-28
- Synetech
-
- 2014-07-29
J'utilise celapourtrouver l'ordre des crochets.Pour obtenir les
filters
,remplacez simplementadd_action
paradd_filter
.function echo_all_hooks() { $not_arr = array('gettext','sanitize_key','gettext_with_context','attribute_escape'); if(!in_array(current_filter(),$not_arr)) echo current_filter()."<br/>"; } add_action('all','echo_all_hooks');
I use thiss to find the order of hooks. To get the the
filters
just changeadd_action
toadd_filter
.function echo_all_hooks() { $not_arr = array('gettext','sanitize_key','gettext_with_context','attribute_escape'); if(!in_array(current_filter(),$not_arr)) echo current_filter()."<br/>"; } add_action('all','echo_all_hooks');
-
- 2015-06-04
Comme @kaiser le suggère,ne publiezpas que des liens,je l'améliore.maisiln'estpaspossible d'utiliser le codeentierici,doncj'utilise quelquesimagesicipourexpliquer commentil a une liste complète des hooks WordPress avec décrire chacun.vouspouvez letrouvericipour hooks , classes ,fonctions ,plugins ,
pour décrire chaque
-
- 2019-08-12
Vouspouvez simplement utiliser unplugin de surveillance de requête: https://wordpress.org/plugins/query-moniteur/
You can just use a query monitor plugin: https://wordpress.org/plugins/query-monitor/
Oùpuis-jetrouver une liste detous les hooks WordPresset fonctions surchargées (enfichables,scriptables,etc.)?
Modifier: Lepluginest répertoriéici .