Link to most recently created category of custom taxonomy in primary navigation menu

Terms are assigned a unique ID when added, and the ID will always increment, so the most recently added term will be the one with the highest ID.

With this in mind, if you fetch a single term ordered by ID in descending order, you should get the most recently added term:

$args = array(
    'number' => 1,
    'orderby' => 'ID',
    'order' => 'DESC'
);

$recent_issue = get_terms( 'issue', $args );

Leave a Comment