When you do the following in your code $posttags = get_the_tags($item->term_id);
, $item
is referring to a post object, not a term object. Therefore, term_id
is an invalid property. This should be throwing a PHP notice.
While not certain, I think what you are intending to do is:
$posttags = get_the_tags($item->ID);
since get_the_tags
takes a post ID, not a term ID.
Related Posts:
- Filtering custom post type query
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Only showing the_date and the_excerpt for first entry in get_posts
- How to use WordPress Conditional Tags in get_posts foreach loop
- Is it possible to use array_walk() to append terms to an array of posts?
- WordPress Random post (last 3 days posts)
- ‘child_of’ in get_posts not working
- Show all videos by tag name
- List all pages including archive
- Better way to query posts?
- Insert term and child term from frontend
- Query if audio attachment AND/OR custom field
- Is There a Difference Between Taxonomies and Categories?
- Generate list of tags from search results
- Foreach inside shortcode not working as planned
- How to get the post content from a category on my homepage
- How do I get post attachments in menu_order in WordPress?
- get_posts() not working in functions.php
- How to sync to custom taxonomies (tag structure)
- Query Problem in getting top viewed posts
- get_posts not working as expected
- Get posts from specific taxonomy term
- Get all pages and posts with get_pages() or get_posts()
- Getting only a specific post type with get_post?
- If tag equals then show else show
- Display post details by post ID
- Way to bulk make all my tags lowercase?
- Pull Tags But Not as Links
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- What is the p parameter in a get_posts() parameter array?
- Exclude post format from get_posts
- List posts that don’t have a specific tag?
- get posts that doesn’t contain a specific tag
- Memory issue with get_posts( ) function
- get_posts() using an array of post ids [closed]
- 100+ terms in any taxonomy slows down post updates?
- merging terms programmatically while maintaining the count
- PHP Syntax Error on get_posts
- Iterate over get_post_meta() result
- Edit the_category (); for a hierarchical display
- Need to put a script above tag in header.php – WP 5.7.1
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- List taxonomy term slugs within shortcode (do_shortcode)
- How can I show the author’s latest post with title?
- Inserting post content into pages when using custom taxonomies
- Include Parent Term in wp_list_categories
- How can I access string value in an array?
- Unique Problem with the php date and get_posts
- get the post_date of ID
- Copy taxonomy terms from one post to another programmatically
- Use Tags to initiate Search
- How i can get post data from database when i am getting post id from url in wordpress
- Filtering a function’ output for a new continued function
- Output meta into arrays
- Limit Taxonomy Output in Conditional Statement
- Get posts by language in Polylang plugin
- Query get_posts by level depth
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Get posts in between specific ID’s
- Get all categories post is not in
- How can I display a div ONLY if it is not a certain term page
- Auto-change Post Status on First Page Load
- Getting taxonomy images to display on single-post with their terms
- Hide image if taxonomy term is empty
- stripping tags from excerpt in WordPress is not working
- Don’t submit post if post title exists
- How to retrive the text : No movie by this actor
- Isotope Drop Down Categories Filter Function
- Hide gravity forms
- Why would get_posts be ignoring posts with 2-digit ids?
- Not able to get random post
- For each loop on every word in post
- List custom queried terms in the edit-tags.php?taxonomy page
- How to filter custom taxonomy term name, slug, and description?
- Order custom post type by custom field (created by PODS) via PHP
- How to Link to Most Recent Custom Post of Same Term
- How to get posts that contain multiple terms from multiple taxonomies?
- The Difference Between Categories and Tags and Taxonomies and Terms
- Hierarchical taxonomy list with modificated term links
- get_posts returns all posts
- Override Blog pages show at most with get_posts
- SQL query generated by WP_Query is not the same what request echoes
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- Calling setup_postdata() causes “Call to undefined function get_userdata()” error?
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Exclude product attributes from taxonomy terms loop
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- How to get image from url from the database?
- Display posts belonging to child term
- How to tag the main tag? [closed]
- Cron task firing but function not working
- wp json api – get posts by category
- meta query not retrieving posts
- Create a a form for custom taxonomy terms
- Querying for specific tags
- Custom Post type Query post is not working
- Unable to render custom field after attempt to generate a list of recent post in page template
- Limit tags shown in post
- Order post by taxonomy
- Default post_tag for custom post type