Your code without using the init hook use also a hook, but not fired from your source. A last it was fired from the include of the your theme, which was loaded in WordPress. It is much bad for your control. If you use a hook, then is the include from your source on your control, you choose the hook. If you will leave this open and the core of WP change the order or other points of the include of theme, maybe you have problem, like the function will never work. Also it is bad style, that you not catch your source inside a wrapper, like a function for the control. Is also easier to read, fied on this hook, this callback – your function.
Related Posts:
- Hierarchical taxonomy UI
- Landing in 404 Page on Navigating to Custom Taxonomy Archive
- how to get title to custom tags page
- Getting yoast title for custom taxonomy
- Current category link filter
- ‘wp’ action hook not firing in admin and login?
- Unexpected results from get_taxonomies() and {$taxonomy}_edit_form and related hook
- put custom taxonomy slug in front of their respective term slugs
- Output unique taxonomy terms of posts inside a loop
- What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?
- How to Modify Default Text in a Custom Taxonomy Admin Panel?
- Reverse order of posts in a certain taxonomy archive?
- how to get term id from current post type instead of name
- WordPress sub taxonomy template
- Sort and paginate custom post taxonomies alphabetically
- Display taxonomy with a maximum number of letters
- Is there a way to change select-list for new custom taxonomy?
- True or F False Setting of ‘with_front’ Parameter of Rewrite Is returning Exact Same result
- Get taxonomy link with post type slug prefix
- use apply_filters return taxonomies custom post type
- deleted_$taxonomy not getting fired
- See double taxonomy inputs in WP editor
- setting a custom post type taxonomy term by code
- transfer two existing taxonomy terms into one custom metabox
- Dynamic drop down of child terms and then drop down posts
- How to get list of custom taxonomies based on custom post type
- Custom button on custom taxonomy listing page
- How to make an sql query to exclude everything but custom taxonomy terms in table wp_terms?
- Where to put a migration script to switch post information?
- How to associate string with individual use of taxonomy term
- How can I get the term_id from the action hook ‘set_object_terms’?
- Hook to filter based on form value and insert term
- Hook function when taxonomy terms change
- Update table wp_term_taxonomy.count after INSERT INTO via SQL
- Get posts in certain Taxonomy terms for the current page url
- Custom Taxonomy specific to a Custom Post type – rewrite URL
- Add child pages to submenu automatically
- What does WordPress do if I save a post without content/title? [duplicate]
- Having Issue on Passing Variable into HTML Class Tag
- Get posts by Taxonomy without terms
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- Is this the proper way to get a taxonomy description into a post template?
- tax_query not working
- WP REST API – get custom taxonomies based on terms & filter
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Weekdays as terms – How to order taxonomy terms by ID in admin panel?
- Returning One custom taxonomy term name
- Question on using custom structures for categories
- How to display ACF taxonomy checkbox links on WooCommerce product category archive
- Make child taxonomy categories use a set template
- Return the most recently created custom taxonomy
- Output single post custom taxonomy child terms
- Proper way to update the slug of a taxonomy using register_taxonomy? [duplicate]
- Custom taxonomy not showing terms in post area
- Adding content to custom taxonomy category pages
- Display formatted list of taxonomy terms with last seperator different
- Forcing a term/taxonomy on all posts of CPT
- How to customize taxonomy archive template files for subterms?
- Displaying Custom Taxonomy without a hyperlink
- Are term IDs unique even between multiple custom taxonomies
- How to customize custom taxonomy url?
- Use the same taxonomy twice on the same post type?
- Get object for a few selected taxonomies
- When filtering query on custom taxonomy; main menu dissapears
- Handling Multi-level custom taxonomy hierarchy
- Check if custom taxonomy has posts with get_categories()
- WordPress set taxonomy on post?
- How to add images to taxonomy terms? [duplicate]
- Exclude taxonomy term from all loops, but having it on widget
- Get all attachments by custom taxonomy – term
- Echo custom taxonomy slug
- Get terms that don’t belong to current post with a shortcode
- Get all terms, including unchecked, or get the terms outside loop
- How can I make front page to display custom taxonomy page?
- Admin (All posts) stop responding problem
- Why get_page_template() doesn’t show taxonomy template file name?
- get_term_link not working
- Why enqueue styles on hook?
- Theme not calling Jquery properly
- Why can’t I use an array of term slugs in WP_Query?
- wp_query not resetting, last post hanging
- Using WP_Query and Query_post for the loop?
- Using wp_dropdown_categories in widget options
- Website loading slowly – Advanced Custom Fields images
- Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
- Copy/clone/associate Custom field to Custom Taxonomy
- Proper WP conditional tag to check for existing taxonomies to list out terms with wp_list_categories?
- Problem with wordpress pagination
- Query posts using custom taxonomy and selected terms
- How to write sql query to get the posts from a custom taxonomy term name
- Foreach loop duplicating a taxonomy thumbnail image
- How to do a particular wp_query taxonomy search
- How to get custom category’s link?
- Edit custom taxonomy description programatically
- How to find taxonomy parent id from child taxonomy page?
- why are the term_id and term_taxonomy_id doesn’t match on custom taxonomies, but are duplicates on categories
- get_the_tags Conditional display of a custom taxonomy
- Removing “trashed” posts from post count in custom taxonomy terms?
- saving meta/custom field to tag
- Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term