1

I am trying to understand how the Admin Tables are populated (for posts, users, plugins...).

With Terms/Taxonomies I am confused. In the /wp-admin/edit-tags.php file everything is normal until we reach the $wp_list_table->prepare_items() method (where an $args is set up to later on go fetch data), but from there on I don't understand where the actual database query takes place.

Looking at the WP Users List Table's prepare_items() method, it's quite clear:

$wp_user_search = new WP_User_Query($args);
$this->items = $wp_user_search->get_results();

So I expected a similar approach for Terms, but looking at the WP Terms List Table class, you can find:

public function has_items(){
    // todo: populate $this->items in prepare_items()
    return true;
}

Which means that the items are loaded somewhere else. But where?

1 Answer 1

1

The items are loaded via get_terms() (see source on Trac) in the display_rows_or_placeholder() method which is called in the display() method which is called in wp-admin/edit-tags.php (see source on Trac). But the $items property is never populated with the terms.

1
  • 1
    Thanks Sally, very clear and helpful answer. May 20, 2021 at 22:58

Your Answer

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

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