<?php | |
/** | |
* Get the term currently being edited on the edit.php screen | |
* in the WordPress admin. | |
* | |
* @return WP_Term|null The term object or null on failure. | |
*/ | |
function km_get_term_being_edited() { | |
global $taxnow; | |
if ( ! $taxnow || empty( $_GET['tag_ID'] ) ) { | |
return null; | |
} | |
$term_id = absint( $_GET['tag_ID'] ); | |
$term = get_term( $term_id, $taxnow ); | |
return $term instanceof WP_Term ? $term : null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment