Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The "manage categories" screen has two interfaces, one when you first click on "Categories" which is used to add a new category and another once you click on an existing category to edit it.

I've added some custom fields to the Category editor, but I only want them to be present on the edit screen, not the "add" screen.

However $pagenow in both cases, is the same (edit-tags.php). The only difference I can see is that when editing, the action=edit token appears on the querystring.

Should I simply wrap my "edit_category_form" filter in a test for the existence of that token or is there a better way?

PS: I'd be fine with leaving the fields on the add screen, however, it appears that the save is ajaxed, and none of my custom fields are being saved in that routine.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can target edit-tags.php page and additionally check for that edit action.

add_action( 'admin_head-edit-tags.php', 'my_category_edit' );

function my_category_edit() {

    global $action, $taxonomy;

    if( 'edit' != $action || 'category' != $taxonomy )
        return;

    // code goes here
}
share|improve this answer
    
Sweet. Thanks for the all the help. Any idea on this one > wordpress.stackexchange.com/questions/6829/… –  Scott B Jan 12 '11 at 21:18
    
@Scott B Did you notice I am basically stalking this site? :) No need to put it under my nose, if I have any ideas about solution (or get them later) I will answer... –  Rarst Jan 12 '11 at 21:44
    
Point taken :) I'm at the end of the punch list and getting a bit antsy to put this one to bed. Always appreciate your help. –  Scott B Jan 12 '11 at 22:10

Your Answer

 
discard

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.