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
- get_template_part vs action hooks in themes
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Display category posts grouped by taxonomy
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- Getting instance variable in scope of ‘wp_enqueue_scripts’
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- On Taxonomy Template page, want to add Post_Type
- Taxonomy query for children of parents
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- How to redirect custom post type archive to first term of associated taxonomy?
- Refresh Taxonomies
- Get Bottom Most Level Taxonomy Terms?
- Get custom taxonomy description with paragraph tags
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Get pages only with a specific taxonomy
- Share taxonomy between user and posts?
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- add taxonomy as one of menu items
- Creating a custom search form
- One query to get posts and their taxonomy terms
- Custom taxonomy query is empty. 0 = 1 in SQL
- Query posts by taxonomy with current term
- How to Get Current Custom Post Type Associated Taxonomy Term
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Query posts from a child taxonomy term id
- Retrieving only custom post types with two required terms (from diferente custom taxonomies each)?
- Get posts by Taxonomy without terms
- Is this the proper way to get a taxonomy description into a post template?
- Get all attachments by custom taxonomy – term
- Get terms that don’t belong to current post with a shortcode
- {$taxonomy}_edit_form_fields not working
- How best to store data (URLs and IDs) extracted from posts and pages using custom taxonomies
- Custom taxonomy link automatically removing query string and re-directing
- Custom taxonomy filter for media
- How to create a custom template for custom taxonomy wp-tag-cloud?
- Find terms in a custom taxonomy based on the hirearchy
- Replace taxonomy term with an image in a custom loop
- Need to display custom taxonomy on single page – not working
- Only display latest custom taxonomy post
- Get 1st parent category id from post
- How to group non-hierarchical tags?
- Show recent posts from a custom taxonomy in wordpress
- update attribute of specific products in woocommerce
- when custom taxonomy is empty, the page won’t load
- Store a value in global scope after init hook is fired
- How do I show the parent term on a custom taxonomy template (not the ID)?
- register_taxonomy_for_object_type (images) : how to use it ?
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- How to show selected check box vendors on front end home page?
- WordPress tag or archive php file customization
- custom taxonomy don’t return a value
- If page is a taxonomy do X, if is a term, do Y
- Custom taxonomy list in two columns
- Get post terms with hierarchical relationships
- Using wp_query is it possible to orderby taxonomy?
- add_rewrite_rule pagination 404 error on page 4 and above