remove_all_actions() – Function | Developer.WordPress.org (original) (raw)
Removes all of the callback functions from an action hook.
Parameters
$hook_namestringrequired
The action to remove callbacks from.
$priorityint|falseoptional
The priority number to remove them from.
Default:false
Return
true Always returns true.
More Information
Prior to Version 4.7
- You can’t call this function from within the hook you would like to remove actions from. For example adding an action to wp_footer that calls
remove_all_actions('wp_footer')will cause an infinite loop condition because the while loop suddenly doesn’t have a next value. In WordPress 3.8.1 you’ll get a warning message like:Warning: next() expects parameter 1 to be array, null given in wp-includes/plugin.php on line 431 - You’ll just need to hook into a hook that’s called before the hook you wish to clear is called.
Since Version 4.7, these limitations have been addressed. Please refer to https://wordpress.org/support/wordpress-version/version-4-7/#for-developers
Source
function remove_all_actions( <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>h</mi><mi>o</mi><mi>o</mi><msub><mi>k</mi><mi>n</mi></msub><mi>a</mi><mi>m</mi><mi>e</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">hook_name, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">h</span><span class="mord mathnormal">oo</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">n</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">am</span><span class="mord mathnormal">e</span><span class="mpunct">,</span></span></span></span>priority = false ) {
return remove_all_filters( <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>h</mi><mi>o</mi><mi>o</mi><msub><mi>k</mi><mi>n</mi></msub><mi>a</mi><mi>m</mi><mi>e</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">hook_name, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">h</span><span class="mord mathnormal">oo</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">n</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">am</span><span class="mord mathnormal">e</span><span class="mpunct">,</span></span></span></span>priority );
}
View all references View on Trac View on GitHub
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |