Can you try to escape the variable $post_id?
Like so: ”.$post_id.”
So use the single quote twice.
You are querying a slug and your variable is a number.
Related Posts:
- Why is my WP_Query not working when tax_query terms are an array?
- How to get any tag ID
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- How to add terms to my tax_query based off of the current post
- Pass array of taxonomy terms to wp_query
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- WordPress Related Post by tags in Single.php
- Function get_queried_object() return NULL in custom taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Get authors by term id or slug
- Taxonomy order exception for specific term
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- How to add custom meta to ‘pre_get_terms’?
- get term id from term name
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Save queried result into database
- taxquery taxonomy get terms
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Is There a Difference Between Taxonomies and Categories?
- Show posts without term
- Search custom taxonomy term by name
- How to display post from current Taxonomy in archive page?
- Display posts the match taxonomy term linked from wp_list_categoies?
- show tags of custom post type ONLY
- How to order posts tag by tag?
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- Display certain amount of posts on taxonomy archive page
- Get all posts without tags
- How to get user_id from wordpress database inside ajax function?
- Allow only 1 instance of each term in each custom taxonomy
- How can I get an array of all IDs from the current queried object?
- Order taxonomy terms in alphabetical order
- Empty tax_query array returns an empty array
- How do I search inside specific taxonomies in WordPress
- Get taxonomy terms only of the WP_Query current posts
- Query post from all category with same tag on 1 pages
- Output an array of terms for a ‘tax_query’ => array()
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Display posts from only one post form in custom query and exclude in main query
- Set attachment tags from attachment’s custom field data
- How can I make WP_Query get posts that have a tag but also have random other tags?
- WP Query Args – Title or Taxonomy Value
- Slow queries on a huge database
- Combining categories (Query posts with multiple taxonomy terms)
- wp_query args adding muitiple tax_querys
- Automatically Query Parent Taxonomy
- 100+ terms in any taxonomy slows down post updates?
- Filter Custom Taxonomy Posts
- get_the_terms – but only show 4 Posts
- WP_Query to output chosen term and posts with no term assigned
- exclude product with available tag
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- Loop posts based on permalink term
- Check if a post has term inside loop
- WP_Query by keyword OR post tag
- WP Query – filtering terms with regex
- How to get posts by category and by choosing a taxonomy term?
- relation OR instead of AND – Filtered term ID’s in loop
- Don’t repeat posts from children in parent taxonomy query
- Compare “Main” post ID to ID inside wp_query loop
- Determine if ID is page or post and query the ID
- Show multiple tax_query from 2 or more post_type in a single code
- Deleting terms from the WordPress wp terms table
- get_the_terms has strange result since version 6.0
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- Filter products on category AND tag
- Strange behaviour of hierarchical taxonomy archive
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- tax_query not working on custom post type
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- get taxonomies from terms
- Get posts that match defined arrays of tags
- WordPress – Form does not filter the results of taxonomies
- Order posts by tags count?
- How to display Woocommerce products list by tag
- Show one post of each custom taxonomy
- Custom category page with taxonomy filters
- Show posts from categories instead of tags
- Exclude all tagged posts from WP_Query loop
- Custom taxonomy and query multi conditions
- Random posts in WP_Query when searching by tag
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- Issue with WP_Query (need a array of selected ID’s)
- Get the tax term in which is a post via wp_query
- GET Taxonomy ID
- Displaying Results From Custom Taxonomy Query
- Limit Tags display and ad Drop Down Menu
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Modify WordPress Search