WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Savvy WordPress user here, or at least trying to be. I have the hang of hooks and filters with the code in WP's plugin.php

The only thing I cannot seem to understand is the $merged_filters global. The value for a tag is unset when a filter or action is added.

However, when an action or filter is executed, the $merged_filters[$tag] value is set to "true".

What is the purpose of this?

Thank you

share|improve this question
Check if this helps... – brasofilo Mar 11 '13 at 13:05
up vote 1 down vote accepted

For those of you who may be wondering what this does - I have figured it out.

When a new function is added to an action/filter hook, it is added at the end of the array. However, WordPress specifies that those functions are to be executed by priority.

When a function is added, merged_filters is used to keep track of whether functions for a hook have been sorted by priority or not. merged_filters is checked on do_action/apply_filters to determine whether the functions should be sorted (by priority) or not before the hook is executed

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.