after_setup_theme fires before init, so in this case the code is trying to insert a term into your taxonomy before WordPress is aware that your taxonomy exists!
Generally, I feel like init is a better location for both pieces of functionality unless you have a reason to do otherwise. But however you resolve it, if you keep the two in separate functions and use the same action, you might want to give the hook which is used to insert terms a larger priority number just for peace of mind, such that it will most definitively always execute after the taxonomy is registered.
Related Posts:
- How to use taxonomies on attachments with the new Media Library?
- How to display custom taxonomies in posts?
- Exclude specific slug in ‘get_terms’
- Hook to process a new taxonomy tag before it is created?
- Custom taxonomy on permalink
- How do I filter posts by taxomony using AJAX
- Multiple users – only allow them to manage their own terms for custom taxonomy when logged in
- How to return a list of custom taxonomy terms via the Gutenberg getEntityRecords method
- wp_options table value
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- Get current term’s ID
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- How to modify default taxonomy field to a single text field?
- How to set hierarchical terms to a post using wp_set_object_terms
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Adding session variable and/or cookie based on user-selected input
- How to link categories to custom taxonomy terms?
- List taxonomy / category count showing list published posts only
- How to display term description in empty terms archive?
- Save Filter for Taxonomies
- Create Child Taxonomies
- Allow only 1 instance of each term in each custom taxonomy
- get_terms: determine if taxonomy term has children
- Set a taxonomy as private
- “show option all” on list categories doesn’t display taxonomy
- Current category link filter
- display taxonomy slug from term ID
- Redirect all child taxonomy to its parent
- Wrapping result of the_terms in a span with a class of the term name
- How do I taxonomy terms based on terms they are used alongside?
- get_term and get_term_by return null or false, even though term exists
- How can I populate a select element with terms from a custom taxonomy and filter post results?
- How do I list the pages of a custom taxonomy?
- What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
- Get taxonomy based on another taxonomy slug
- Why does a new taxonomy term get created when I assign an existing term to a post?
- Add Image Uploader In Admin Panel
- Tell the difference between a term and page when they have the same ID
- Getting associated taxonomies
- How to use multiple archive templates for a taxonomy?
- Adding custom taxonomy in my existing category URL
- How to get posts which must match both custom taxonomies?
- Custom Taxonomy with tax_query
- How to add images to taxonomy terms? [duplicate]
- Why get_page_template() doesn’t show taxonomy template file name?
- Edit custom taxonomy description programatically
- Get taxonomy name for the current post
- one post per term taxonomy
- How can I change the output display of my pagination?
- Get name of taxonomies of current page
- How to get attached image to taxonomy..?
- How to get list of only custom taxonomies?
- Add custom taxonomy as a css class
- Query custom taxonomy for category including children
- How can I get Taxonomy Images to work with ‘orderby’ argument?
- Use wp_list_categories to list parent categories from actual term
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- Trash Bin for Categories?
- How to add a dynamic dropdown derived from custom taxonomy
- Retrieve the child terms by having the parent’s information
- add pagination in wordpress page template
- how do you pull data from two taxonomies?
- problem : Custom taxonomy template not showing
- How to create a non removable taxonomy term?
- Custom dropdown list taxonomy not saved
- How to get all the terms from a custom hierarchical taxonomy via REST api?
- How to show category list in WordPress
- Filter “get_terms” query
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Change link of taxonomy when get_the_term_list( is used?
- generate random slug when adding taxonomy
- transfer two existing taxonomy terms into one custom metabox
- Custom taxonomy shows full articles
- How to add all existing Custom Taxonomy to Admin Menu Creations Interface?
- Why get_terms() behaves strangely when being called in admin (for use in meta box)?
- qtranslate-x problem with custom term description
- Templates files for custom post type with custom tags
- Creating a Taxonomy Page [duplicate]
- Change order custom taxonomy
- Looking for suggestions on creating simple database (Help!!)
- Extra fields on categories that is available via the WP-API?
- Custom taxonomy – query returns an error
- Register custom taxonomy from a Advenced custom field option page
- List of taxonomy archive index page links
- Get Posts with matching lowest taxonomies
- Any way to make custom taxonomy field searchable?
- query posts returns 10 records
- Insert taxonomy term to different table
- Getting taxonomies specific to categories
- Remove Tag Cloud Words from Custom Taxonomy
- How to add/enqueue Custom CSS for a custom taxonomy page?
- wp_get_object_terms count on taxonomies within an category archive
- Group custom taxonomies based on tags contained in their posts
- Make custom post type display with custom taxonomy in url
- Save selected terms in order of custom taxonomy in post
- Taxonomy entries are spawning copies of existing entries with the new title as the existing ID, since upgrade
- How to get parent and child name in taxonomy page
- Change taxonomy key of existing and future taxonomy posts