get_the_terms( $id, $taxonomy );
is what you’re looking for, I guess.
You can pass array as $taxonomy
param. So this snippet:
$posttags = get_the_terms($post->ID, array('category', 'post_tag'));
should do exactly what you’re trying to achieve.
Related Posts:
- Numbering lines of code with the tag?
- Randomizing wp_tag_cloud() in child theme
- require_once() Causing categories and tag pages on dashboard to not refrsh
- Upload Multiple Files With media_handle_upload
- What is this code in my theme’s functions.php? if (isset($_REQUEST[‘action’]) && isset($_REQUEST[‘password’])
- current_cat_ancestor Alternatives
- Add body class of category parent
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Php string not working in WordPress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
- Add class to Categories Widget
- How to Acheive the custom woocommerce category template
- VERY new to coding – keep breaking site trying to add to functions.php
- Problem with tag
- How to add a rel attribute to images that contains their categories?
- get_the_excerpt() not returning anything when post has no excerpt
- How to set child post categories to parent post categories when updating parent post?
- Automatically add author’s name to post_tag
- Assign category using custom field?
- Pinterest Integration Using functions.php
- How To Get WordPress Categories Link List?
- Adding a class to tag list in a function
- Changing post category from dropdown
- Manipulate Output of wp_list_something: select menu instead of li’s
- Make Categories a Dropdown Menu in Media Library
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Programmatically Create Category and sub Category
- Attach parent category template to all subcategories
- If in category to be inside of a function
- exclude a category from a search on a specific page
- Get the category name outside of the loop in category.php
- Create single.php for specific tag by tag id or name
- Is it possible to change any of the HTML/URL returned from the_category()
- list tags with count in author profile page
- Product Tags in Add New product as checkbox list [closed]
- Possible to display shortcode based on the category?
- Unset Category if other Category is unset during post transition
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Retrieve tags data in post body
- Select pages by category
- Echo tags used to describe the theme
- Frontend tag edit/submit form
- Show Primary Category first when I display post categories
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- How can this crude function be improved?
- Get category URL for current post
- allow only one post in specific category
- Edit the_category (); for a hierarchical display
- How to obtain the recent posts without their content in an efficient way?
- Setting a default text for excerpts of a particular category
- Running script based on Category
- Remove a category from a post when saving a new post
- How to fix get_the_category function returning incorrect slug?
- How to edit the Tags within the image file URLs?
- Return category name with & Ampersand doesnt work
- How i can put $_GET codes in function.php?
- Function filter breaking tag archive menus
- Tags break custom Excerpt function
- Access category within rss2_head hook?
- issue with if/elseif in_array inside foreach loop display only one post
- add_filter to specific WooCommerce Category
- Image loading function not working on archive.php template
- Problem with calling custom function in a foreach loop
- Specify multiple categories for custom post template – FATAL ERROR
- “All posts” in the category widget
- Get Attachment Category Name
- Sort and display pages with specific custom field (not tag)
- Function to echo (or display?) wordpress tags in the head section
- WordPress Categories: Function using custom SQL to return array of specific category IDs
- Display ACF category image on archive and single template files
- Get slug of current category in functions.php
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Remove the ‘category’ url for one category type
- Allow user only create specific tags
- Custom Function.PHP Code Not Working on One Site
- How set a while with a function
- how to remove a tag in the_category function
- i can’t use wordpress functions in ajax loaded php file
- Removing sanitize_title_with_dashes Function with The Real Title
- Drop down list code for sidebar
- Graphic before title – Specific Category
- method to fetch entire tag list on archive.php
- different body classes for each category
- Some code is added automatically to my site’s header – what is it?
- How to include a hyperlink in the body text of a custom password protected form?
- Custom taxonomy not refreshing page on add
- Automatically add tag if a checkbox is checked
- getExcerpt: Make ellipsis appear only if character limit is reached
- How To Get WordPress Categories Last Update Date?
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- How to add a class name to the ancestor of a post?
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Code in functions.php appearing on front-end and dashboard [closed]
- If two tags in the middle i need comma
- I want to add the alt attribute to all the photos!
- Removing all Category pages with one exception
- Bulk set Post Title as Tag where Tag is Empty Function
- Bad value crossorigin for attribute crossorigin on element link
- Get category of post inside save_post hook
- Convert Image to Webp on upload without plugin