New answers tagged id
No, you cannot (easily) choose what tag ID is assigned. It's not random - it's the next ID available after the last one that was created in the database. If you really want to control tag IDs, you'll need to clear your database and start fresh, and create each tag in the order you want their IDs to be (and you won't be able to change them afterwards without ...
Try this function wp_get_post_categories() Check more reference from here: https://developer.wordpress.org/reference/functions/wp_get_post_categories/
Top 50 recent answers are included