{"id":539,"date":"2006-05-16T21:38:30","date_gmt":"2006-05-16T19:38:30","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/my-projects\/wordpress-hooks-filter-flow\/"},"modified":"2007-04-21T16:10:56","modified_gmt":"2007-04-21T14:10:56","slug":"wordpress-hooks-filter-flow","status":"publish","type":"page","link":"https:\/\/planetozh.com\/blog\/my-projects\/wordpress-hooks-filter-flow\/","title":{"rendered":"WordPress Hooks &#038; Filters Flow"},"content":{"rendered":"<p>Basically, a plugin for WordPress creates a PHP function (a <strong>filter<\/strong> or an <strong>action<\/strong>) which is called when a particular event (a <strong>hook<\/strong>) occurs, for example when a post is printed or when a comment is posted (for more info about hooks, filters and action, check the <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\">Codex<\/a>)<\/p>\n<p>When developping a new plugin, you sometimes encounter unexpected behaviors from your code, which can originate from a filter conflict : another PHP function with a higher priority was triggered before your own function, and processed the same bits you&#39;re trying to pass through your function.<\/p>\n<p>That&#39;s why when developping plugins, it&#39;s important to be well aware of what I call the Filter Flow : for each hook, which functions are called in which order ?<\/p>\n<p>So, I wrote this script : WordPress Hooks &#038; Filters Flow<\/p>\n<h2>List hooks and current filters<\/h2>\n<p><img decoding=\"async\" src=\"\/blog\/images\/wp-hooks-filters-flow.gif\" class=\"imgleft\" alt=\"Wordpress Hooks and Filters Flow\" \/> The script runs in your WordPress root (or in <em>\/wp-admin\/<\/em> if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook, active filters (or actions, they&#39;re the same) are listed in their execution order, which is either defined by their priority or by their loading order. The purpose of such a list is to help hunt plugin bugs down, and let you wisely fine-tune plugin priorities if needed.<\/p>\n<h2>Get the script<\/h2>\n<ul>\n<li><a href=\"http:\/\/planetozh.com\/download\/plugins\/wp-hooks-filters-flow.txt\">wp-hooks-filters-flow.txt<\/a>: save and rename as .php<\/li>\n<li><a href=\"http:\/\/planetozh.com\/download\/plugins\/wp-hooks-filters-flow.php\">wp-hooks-filters-flow.php<\/a>: cut and paste into a blank file (this is colorized HTML, not raw code, do not download and run as is)<\/li>\n<\/ul>\n<p>Put the script in your wordpress root or in &#39;<em>\/wp-admin\/<\/em>&#39; and you&#39;re done.<\/p>\n<h2>Feedback<\/h2>\n<p>Only if it&#39;s to say &quot;woohoo it&#39;s cool&quot;. <strong>No<\/strong> support or troubleshooting with your plugin problems. These are <strong>your<\/strong> plugin problems :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basically, a plugin for WordPress creates a PHP function (a filter or an action) which is called when a particular event (a hook) occurs, for example when a post is printed or when a comment is posted (for more info about hooks, filters and action, check the Codex) When developping a new plugin, you sometimes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-539","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=539"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/539\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/241"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}