The function below can be used for getting the WP_Term object for the term that’s currently being edited on the term.php page in the WordPress admin. Just make sure that when you call this, the globalĀ $taxnow variable has been set. Using WP’sĀ admin_init hook, or anything that fires after that point will work.

Example usage

2 comments

  1. V November 2, 2018 at 9:43 am

    Reply

    Thanks for the post Kellen. I’m trying to add a VC block using ACF on the terms (term.php) of a custom taxonomy. In this block, need to output the current term being edited. Any thoughts on how fetch the value of the term being edited on term.php?

    • Kellen Mace November 9, 2018 at 2:54 pm

      Reply

      Hey V! By “VC”, do you mean Visual Composer? Not quite clear on what you’re trying to do. Did you try using the km_get_term_being_edited() function from this post to determine which term is being edited on term.php?

Leave a reply

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