admin管理员组

文章数量:1125550

I'm using the following code to create a custom metabox on a custom taxonomy page.

$term_filter_name_edit = $type . '_edit_form_fields';
add_action($term_filter_name_edit, 'box_term', 1000, 1 );
function box_term() {
  echo 'Test output';
}

However, this outputs Test output before the default term fields. I want it to output after the default term fields.

How can I achieve this?

--

Curiously, using _add_form_fields outputs after the fields on the add page, but using _edit_form_fields seems to output before.

I'm using the following code to create a custom metabox on a custom taxonomy page.

$term_filter_name_edit = $type . '_edit_form_fields';
add_action($term_filter_name_edit, 'box_term', 1000, 1 );
function box_term() {
  echo 'Test output';
}

However, this outputs Test output before the default term fields. I want it to output after the default term fields.

How can I achieve this?

--

Curiously, using _add_form_fields outputs after the fields on the add page, but using _edit_form_fields seems to output before.

Share Improve this question asked May 22, 2018 at 16:56 Kevin RobinsonKevin Robinson 617 bronze badges 1
  • Even more curiously, the documentation seems to suggest that it should output after the form fields. Perhaps I'm doing something wrong, but I can't see quite what that might be. developer.wordpress.org/reference/hooks/… – Kevin Robinson Commented May 22, 2018 at 17:00
Add a comment  | 

1 Answer 1

Reset to default 1

Got it!

It seems this action is fired within a table element.

Removing the _fields part seems to have done the trick as this refers to an action fired later in the page, after the table.

$term_filter_name_edit = $type . '_edit_form';
add_action($term_filter_name_edit, 'box_term', 1000, 1 );
function box_term() {
  echo 'Test output';
}

Reference: https://github.com/WordPress/WordPress/blob/master/wp-admin/edit-tag-form.php

本文标签: taxonomytaxonomyeditformfields output after term fields