#6: wp_terms_checklist_args

The wp_terms_checklist_args filter allows you to modify the arguments array in wp_terms_checklist, which is located in wp-admin/includes/template.php. wp_terms_checklist is the taxonomy-independent version of wp_category_checklist and only works with hierarchical taxonomies.

It accepts two arguments:

  1. array $args The arguments array (see wp_terms_checklist for the defaults
  2. int $post_id The post id

Example:

Let’s say you have a hierarchical taxonomy called ‘Media Categories’ — with a slug of media_cats — that you’re using with media attachments. And let’s say you don’t want the selected categories to float to the top of the box (the default behavior).

View the code example on Gist.

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

Leave a Reply

Your email address will not be published. Required fields are marked *