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?
- Need help with Query Loop. Need to get current taxonomy term and its posts and group them by a different selected taxonomy term
- Is There a Difference Between Taxonomies and Categories?
- Posts with at least 3 tags of a list of tags
- Show posts without term
- Control term order on a per-post basis
- WP query taxonomy input differs to output?
- Search custom taxonomy term by name
- Better way to get tag stats?
- How to display post from current Taxonomy in archive page?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- 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?
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Get All IDs Of A Post Type Using WP_Query
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Loop through all tags & output posts in alphabetical list
- Order posts by tags count?
- Move posts to top of WP_Query if in certain Taxonomy?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Display certain amount of posts on taxonomy archive page
- Querying Multiple Custom Taxonomy Terms
- List taxonomy terms plus their latest post ordered by post date
- Get random terms
- Get all posts without tags
- Order terms inside a select dropdown
- Filter and list posts of a custom taxonomy
- List all custom post type posts from a given category?
- WP Query – Get WooCommerce Products with variation that is in stock
- Filter WordPress posts by between parameter
- How to Modify Taxonomy Archive Page with Search Parameter?
- Get array of current post term ID’s
- How to get user_id from wordpress database inside ajax function?
- How to exclude products by tag from woocommerce shop page?
- Filtering posts by custom field value not working
- Allow only 1 instance of each term in each custom taxonomy
- Pagination problem after WP_Query with tag filtering
- Change default ordering of taxonomy terms – pre_get_terms
- Display link to taxonomy archive only if it has posts with certain custom field values
- How can I get an array of all IDs from the current queried object?
- How do I get the current tag out of a taxonomy?
- Order taxonomy terms in alphabetical order
- Is it possible to dynamically get queried term AND taxonomy?
- WP Query for variable taxonomies
- 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
- Get list of terms that have posts in another term
- Query post from all category with same tag on 1 pages
- reducing the amount of wp_query calls
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- Output an array of terms for a ‘tax_query’ => array()
- Getting Taxonomy inside WP_Query Loop
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- Complex WP_Query (two post types and multiple operators)
- 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
- Include tags in WP_Query
- Search for multiple tags?
- Display posts from only one post form in custom query and exclude in main query
- Remove category from query (show all posts in archive.php) pre_get_posts()
- is_tax() function not working as expected
- Advanced Taxonomy Queries WordPress
- Set attachment tags from attachment’s custom field data
- Display Featured Post by Categories and Avoid duplicated posts
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Custom post taxonomies as tax_query terms?
- WP_Query tax query part of slug
- Taxonomy Query Relation field not behaving correctly?