If you dump the code into functions.php
, then the custom taxonomy hasn’t been registered, because it isn’t recommend to register custom taxonomies earlier than the init
hook.
Running the code within the template hierarchy files should work, because it’s later than init
.
If you want to run it within the functions.php
file, make sure to hook it accordingly.
Related Posts:
- Using get_terms for custom taxonomy in functions.php
- Adding a class to tag list in a function
- Make Categories a Dropdown Menu in Media Library
- Identical custom taxonomy slugs for same hierarchical children
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Get list of all custom tanonomy id
- Get Comma Seperated Taxonomy Linked Terms and Last Child Separated By “&” Instead Of Comma
- Output a specific link in WordPress post if the single post’s category’s name contain certain word
- Possible to merge these two functions?
- Suggest Users basing on User taxonomy
- How add body_class from wp_termmeta
- Display ACF category image on archive and single template files
- Get URLs for AJAX Filter Checkboxes WordPress
- Using get_terms for custom taxonomy in functions.php
- I’m getting invalid taxonomy in init action
- Taxonomy On Index Page
- Only seems to be displaying one child when there are supposed to be multiple
- How do I get the current edit page ID in the admin?
- Order posts (across the whole site) by metadata date
- Disable visual editor on one specific page
- How to display random users with avatars
- Apply custom role capabilities to administrator (without plugin)
- Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?
- In a WordPress plugin, how do you output HTML code inside the DOM header? [closed]
- Different ‘WP_CONTENT_URL’ for different subsites in Multisite setup?
- Linking thumbnail to full size image
- Removing Unnecessary Text from Admin Menu without CSS
- Display WordPress Search
- Preferred Use of home_url()?
- Functions.php reverted to new one
- Where does function_exists() look to decide whether a function exists? [closed]
- Get page slug and assign a variable within functions.php
- Multisite, either change the name of sample-page or create new page
- What is the “icon” parameter in wp_get_attachment_image_src used for?
- How to use thumbnails in gallery?
- Hide Author.php template from specific user role
- Customizer field value into functions.php variable
- wp_insert_posts keeps adding multiple pages
- Best practice when altering a parent theme function inside a child theme?
- list tags with count in author profile page
- Breadcrumbs – Exclude Child Categories
- Auto delete post if certain custom field data is empty
- Why won’t my scripts load?
- using `require` in my functions.php breaks the site
- Is it OK to include files using ABSPATH?
- Overwriting Parent Theme’s Image Sizes
- Limit length of first excerpt in the loop
- check if the user is owner of current page
- How to set the default avatar of buddypress avatar [closed]
- Custom styles.css sheet for visual editor
- Publishing just a Facebook URL without full code snippet
- Filter an WordPress Function in (general-template.php)
- attachment page template? only show attachments for current post?
- Conditional statement not working in function
- Adding code before post title with the_title produces weird results
- Remove the month and year from a WordPress Date?
- How to insert class in each list of categories?
- The correct way to add a JavaScript in the functions.php [closed]
- How to remove some item from WordPress Dashboard for user Author
- Editing the formatting.php file vs functions.php file?
- How to make a new function that includes a template
- Disabling Author Page only for subscribers
- Function not saving unchecked checkbox
- Removing parent theme CSS without editing parent theme
- Showing user profile data on front-end
- How to register a menu based on a ACF condition
- Breaking up multiple words and inserting an image after first word
- Why is this function crashing my wordpress installation? [closed]
- colorbox not loading in
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- How to Override Page Template if URL matches query?
- Save_post – Warning: Cannot modify header information
- Woocommerce Display Discount On cart
- Modify content inside post before first publish
- How to offset main query without affecting other queries and backend
- ACF Date Form in Custom Admin Field
- how to remove a tag in the_category function
- Function to disable “href” anchor tags that contain “a data-name” on mobile only
- Execute jQuery with custom event listener after successfully add an item to the cart
- Copying a widget class to functions.php results on a blank page
- WordPress undefined function error on using add_action() in functions.php
- How to create admin ajax function for my contact form
- No compression occurs on my jpegs after adding jpeg_quality hook to my functions.php file
- Changing the register url is not working
- how to display featured image for single post for a specific category
- Database Query not working
- Can I use a function to return HTML and the result of another function?
- Figure inlined width trigger distorted layout
- save_post hook – headers already sent?
- How to use WP_rewrite?
- Wp get archive only text not link
- can not call functions in function.php
- Custom shortcode not being included in content paragraph [duplicate]
- Display post_meta-by_key on product catalogue
- What are the parameters are used in add_action and filters?
- Which template file to edit to edit homepage in Mystile [closed]
- Does functions.php apply to every page?
- Load script only on selected Pages
- Using input_attrs() Multiple Times Within One Customizer Control
- Convert Image to Webp on upload without plugin