Did you try to use add_action without priority? On the last line, you specify the priority. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
function test_1234567() {
// Get term by name ''news'' in Categories taxonomy.
$category = get_term_by('name', 'news', 'category');
// Get term by name ''news'' in Tags taxonomy.
$tag = get_term_by('name', 'news', 'post_tag');
// Get term by name ''news'' in Custom taxonomy.
$term = get_term_by('name', 'news', 'my_custom_taxonomy');
// Get term by name ''Default Menu'' from theme's nav menus.
// (Alternative to using wp_get_nav_menu_items)
$menu = get_term_by('name', 'Default Menu', 'nav_menu');
var_dump($category);
}
add_action( 'init', 'test_1234567' );
Also, you do not need to specify the priority, the default is 10.
Related Posts:
- exclude multiple terms using get_terms() function
- wp_set_object_terms and arrays
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Allow authors to post only in categories they create in WordPress
- Add custom field to attachments in a specific category
- How to Populate the list of custom post type categories
- category not display in word press grammatically
- Php string not working in WordPress Functions.php [duplicate]
- List all categories but exclude current post category on single post page
- Use template for posts with a particular category grandparent
- Check if Product is in a Specific Category in Functions.php
- Check if term object is in array
- Woocommerce – remove product from category
- get_the_terms – only top level
- Query all posts of a custom taxonomy term
- get current product name in functions.php
- get post based on category chosen in drop down – The ajax method
- Swapping wp_dropdown_categories function with wp_category_checklist
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- get a simple array of all of the term names that exist in all taxonomies
- Pass Category Name, Description and Photo into variables to pass to jQuery
- How to pick the default selected value in wordpress dropdown?
- Get page that displays all children of taxonomy parent
- Dilemma of Populating all the categories in a drop down list
- Edit the_category (); for a hierarchical display
- Include Parent Term in wp_list_categories
- Limit Taxonomy Output in Conditional Statement
- Get all categories post is not in
- Displaying posts based on category
- Isotope Drop Down Categories Filter Function
- Hierarchical taxonomy list with modificated term links
- How to get current post category details inside “loop”?
- Show all tags within a category?
- Post not populating for custom post type based on category selection
- WordPress custom taxonomy
- How do I edit the terms output args or array data?
- Dropdown category field inside repeatable metabox
- Display Visual Composer shortcode if a post belongs in specific categories
- Get parent category name when only child category is applied to a product
- How to move a post from one category to another
- Create category after theme setup and modify the default one
- Notice: Undefined variable
- Hide a specific category title from displaying on site
- Populate Posts based on category selected using AJAX that means without page refresh
- All categories options or All categories not Populating
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- PHP get_category() function redeclared
- WordPress using get_term to retreive slug not working as expected
- Get category id for a custom category and display it in a class
- Trying to see if page is category or single and displaying title with appropriate heading tag
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Incomplete term slugs output from a foreach loop with get_the_terms
- Displaying categories
- How to insert the first letter in uppercase [closed]
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- WordPress different custom tag being displayed in on tag list
- Exclude a category ID from the following function
- How to call a function only once (global variable scope)
- Multiple is_page() in page.php
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- How can update custom meta for all posts
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- syntax issue on php 7.4
- How can I use wp_insert_comment to write a comment when a post is edited?
- Where do posts get the sidebar from?
- How to remove the excerpt in the Dzonia Lite theme
- How do you add customer capability after Woocommerce purchase?
- How to put a variable in a instance in the widget
- Logged in user ID as post ID
- Show categories then when clicked on a category list all sub category and when clicked show all posts in that sub category
- How to store data from multiple forms using ajax and php
- How to control WordPress image metadata (using Imagick)?
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- Is it possible to return content, and then also continue to do other things?
- How to use mysql LIKE with wpdb?
- woocommerce related product title length
- Do not duplicate posts with multiple categories in multiple loops
- Query for user roles
- Displaying Event within two given time frames
- List posts by their custom taxonomy term, with a condition
- How to call custom function outside from the admin page?
- Use of antispambot with $curauth->email
- Reject all malicious URL requests functions.php
- admin panel – How to remove “delete” button from category editing page
- How to override WooCommerce Order Item Meta with data from Cart?
- Taxonomy Child Term, Counter is staying on 0
- Access to “My Site” is missing from the admin bar
- How to redirect (301) trashed post to it’s parent taxonomy TERM ARCHIVE instead of 404 page
- PHP drop down menu for my get_category child of
- Using get_theme_mod with checkbox to display content
- Styling admin page rows in order of importance (checkboxes)
- Break a WordPress function to run in patches and re-continue
- Pagenav Not appearing on custom Template
- My title is showing after the shortcode
- Adding multiple conditional tags in a function?
- a problem in class in class-wp-hook.php
- WordPress taxonomy and terms question