I've added a "Custom Title" field to the Category editor in order to capture a keyword friendly title that can be used separately from the category name. It works great, but it appears as the last input element of the category screen. Ideally, I would like it to sit under the "Name" field (or at the very top). Is this possible?

Here's the code I'm using to add my custom input field to the category edit screen...

if($pagenow == "edit-tags.php" && $_REQUEST['action'] == "edit") 
add_filter('edit_category_form', 'my_category_fields');

function my_category_fields($tag) {
$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);?>
<table class="form-table">
    <tr class="form-field">
        <th scope="row" valign="top"><label for="categoryTitle">Full Category Title</label></th>
        <td><input name="categoryTitle" id="categoryTitle" type="text" size="40" aria-required="false" value="<?php echo $tag_extra_fields[$tag->term_id]['cat_title']; ?>" />
        <p class="description">The title is optional but will be used in place of the name on the category landing page.</p></td>
  • I know it's not an answer, but I'm curious why you would do this at all? Is it to distinguish a human readable category title from an SEO-optimized version you use in the template? Commented Jan 12, 2011 at 21:38
  • In essence, yes. The default "Name" field is fine for lists such as when someone pulls over a "Category" widget into a sidebar. However, when you are viewing a category landing page, a fully descriptive title works better. But I wouldn't use this "Title" in lists since the default category "Name" field is more appropriate for that, IMHO.
    – Scott B
    Commented Jan 12, 2011 at 22:05
  • I do the same thing for post titles. I use the default post/page title in menus and navigation lists, but when I get ready to echo the post/page title on single.php or page.php, I use a custom field that captures a more descriptive (and SEO friendly) title.
    – Scott B
    Commented Jan 12, 2011 at 22:07

2 Answers 2


WordPress doesn't provide the hooks you want but it you are willing to use PHP's output buffering and preg_replace() you can get it to work without hacking core. Here's an answer that talks about the general technique required:

The hooks you'll want to use are 'category_pre_add_form' for ob_start() and 'category_add_form' for ob_get_clean().

  • That's an interesting option Mike. Also should eliminate the flicker problem inherent in the javascript option. Thanks as always!
    – Scott B
    Commented Jan 13, 2011 at 13:52
  • Great idea.
    – MathSmath
    Commented Jan 13, 2011 at 19:02
  • @Scott B - Yes, I always prefer to do in PHP whenever possible. I like to use jQuery for interactivity, not to bandaid less-than-ideal HTML generation because, as you mention, it's a lot cleaner. Commented Jan 13, 2011 at 23:18
  • @MathSmath - Thanks. I've had a client push me really hard and I've learned there is (almost) always some way to make it work w/o hacking core. Of course it's not always pretty... :) Commented Jan 13, 2011 at 23:18

There is no php-based solution without hacking core. Crack open the file wp-admin/edt-tag-form.php and you'll see it. The hook you're using is fired right before the submit button, and the rest of the form is hard-coded.

But can probably do this with jQuery. Read my answer to this similar question for an example. The example is for the post edit screen, but the concept should be the same--use jQuery's insertBefore() method to move an element (by ID) before another element (by ID).

  • I like your idea with the jQuery bits. But it looks like I'm stuck, since the category edit fields (the TR elements) don't have IDs assigned to them that I can interrogate with jQuery.
    – Scott B
    Commented Jan 13, 2011 at 2:36
  • On second thought, since i want to insert my row just after the first row of that table, I suppose I should be able to get another means of DOM traversal than getElementsByID...
    – Scott B
    Commented Jan 13, 2011 at 2:39

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.