Find highest WordPress filter priority

Sometimes you reeeeeally want your filter to run last and you can use this code to make sure it does!

Drop this snippet into your plugin to output the highest priority currently registered:

$highest = 0;

foreach ($wp_filter as $filter) {
    foreach ($filter as $key => $value) {
        if ($key > $highest) $highest = $key;
    }
}

echo $highest;

Leave a Reply

Your email address will not be published.