I'm at my wits end. I'm beginning a project that may involve using an action hook in WP that is not well-documented: edit_{$taxonomy}

I'm trying to determine exactly when this hook runs, so I just wrote a basic function with an echo for testing. Then, I added it to functions.php in a child theme. Invariably, the line with the echo causes a "Headers already sent" error. If I comment out the echo, it's fine. I thought it might have something to do with the order in which php files are loaded when using child themes, so I went head and pasted it into the bottom of the parent theme functions.php. Same issue.

Here's the code:

add_action('edit_expedited-status', 'category_status_email');
function category_status_email() {
echo "Testing";

Any thoughts or ideas appreciated.


Note: Update not from author

On /wp-includes/taxonomy.php, you'll find (v3.3) on line 1586 the following filter under the context/action edit:

$value = apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id);
  • I can't find any action named 'edit_{WHATEVER}-status' in core. Could you please point at the file + file number?
    – kaiser
    Commented Jan 31, 2012 at 2:58
  • It's not listed in the Codex. It is listed on Adam Brown's hook directory: adambrown.info/p/wp_hooks/hook/edit_%7B$taxonomy%7D.
    – mburtis
    Commented Jan 31, 2012 at 3:55
  • Just to be clear, the custom taxonomy I'm using has an id of "expedited-status" that's why the hook is "edit_expedited-status". It's a variable hook.
    – mburtis
    Commented Jan 31, 2012 at 3:56
  • Also, I'm not sure why someone changed the title of the post. While I am, ultimately, trying to determine the role of this hook, this post is specifically about the strange header error I'm getting. I reverted.
    – mburtis
    Commented Jan 31, 2012 at 3:58
  • WordPress is probably trying to send headers after you echo. If you echo "Testing";die(); you won't get that error. I'm a little unclear about what your question is -- do you want to know when edit_$taxonomy runs? Commented Jan 31, 2012 at 4:15

2 Answers 2


Please have a read on how to work with filters and actions (I'm not repeating it here).

The filter in a theme or plugin

// inside /wp-includes/taxonomy.php on line 1586
$value = apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id);

// inside some theme file that runs before - best on functions.php during your themes bootstrap:
function wpse40709_edit_tax_field( $value, $term_id )
    // Do modifications

    return $value;
// Should be hooked in bootstrap, so best would be 'after_setup_theme' until 'admin_init'
add_filter( 'edit_YOUR-TAXONOMY-NAME_YOUR-FIELD-NAME', 'wpse40709_edit_tax_field', 20, 2 );

The filter in core

The filter gets triggered, when

sanitize_term_field($field, $value, $term_id, $taxonomy, $context)

runs. So the $field is whatever name your field has.


I think the problem is that you need to run the hook during init

  • 1
    Please, elaborate the Answer a bit more... Code example?
    – brasofilo
    Commented Oct 25, 2012 at 0:34
  • Please improve your answer. Explain why your suggestion solves the issue.
    – fuxia
    Commented Oct 25, 2012 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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