which gives me all posts inside the tax inspiration – I need to alter this, so that I get only selected ID’s in my array, ex. 4714, 3608, instead of all terms of the tax.
I’m assuming you mean that this query gives you all posts inside post type inspiration and you want to pull specific post IDs instead of all posts of the post type. Taxonomies and Post Types. are two different things.
Try to alter your query to something like this:
$loop = new WP_Query( array(
'post_type' => 'inspirations',
'post__in' => array( 4174, 3608 )
));
The difference between this and your original loop is that 1) There is a post type defined and 2) post__in has 2 underscore where yours has 1. I removed the posts_per_page parameter as this query should only return 2 posts.
Related Posts:
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How can I save an array from a random post sequence for later use?
- How can I get an array of all IDs from the current queried object?
- Get posts by list of post IDs ordered by those IDs?
- Include current post into loop
- Compare “Main” post ID to ID inside wp_query loop
- Determine if ID is page or post and query the ID
- Loop through array of pages
- Repeat array inside array through while loop
- Iterate through ID’s in loop
- after refresh the id that shows correct in first time click, changes to 1
- Can I force WP_Query to return no results?
- Resetting post data to previous loop in nested loops
- Some doubts about how the main query and the custom query works in this custom theme?
- Get post count of current loop when using multiple queries on one page
- Multiple WP_Query loops with Pagination
- Using a custom WP_Query with get_template_part loop
- WP_Query vs get_posts
- Loop within a loop?
- WP_Query and next_posts_link
- Show posts without term
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Display products from specific category in shop page
- How to list some posts first in the loop based on post id
- Pagination returns 404 after page 20
- Make loop display posts by alphabetical order
- WP_Query: query posts by ids from array?
- Use WP_Query with have_posts()?
- get custom post type by tag
- How to get order of posts?
- Order posts by ID in the given order
- get_template_part in for loop
- Get array of posts from the current archive page loop
- pre_get_posts with get_posts
- How-to exclude terms from the main query the most performant way?
- What kind of object type is WP_Query?
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- Executing Queries in tag.php
- Display posts the match taxonomy term linked from wp_list_categoies?
- How to place a loop within another loop?
- WordPress Custom Query to show posts from last x years
- How to order posts tag by tag?
- Query Custom Meta Value with Increment
- “pre_get_posts” firing on every query
- Getting an array out of WPQuery
- Show two random posts from custom post type
- Get All IDs Of A Post Type Using WP_Query
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Loop through all tags & output posts in alphabetical list
- Pagination with 5 posts per page
- Identify which loop you are hooking into; primary or secondary?
- In loop: posts have thumbnail AND other variables
- Group posts by custom field
- How to order category.php loop by ‘meta_value’?
- Pagination/infinite scroll with WP_Query and multiple loops
- Merging a complex query with post_rewind and splitting posts into two columns
- Sort posts by custom taxonomy name
- assign 2 $args to one wp_query
- Add inline HTML to posts published within last 24hrs
- Use Transient API to cache queries for all posts in all categories?
- Move posts to top of WP_Query if in certain Taxonomy?
- Loop inside the loop
- Pagination Not working on Home Page with 2 Query
- meta_query not working properly
- Ajax Infinite Scroll In Custom WP_Query Loop Not Working
- How to get any tag ID
- Display different number of posts from one category on the different pages
- WP Meta Query for some meta (array) values
- Looping through tabular data
- Trying to list out child pages with WP_Query
- Exclude post on loop by multiple meta key value
- Pagination not working Search posts
- How to change a custom query into a standard loop?
- meta_query with array as value
- Transient pagination not working properly
- Show default content if custom WP_Query has no posts
- get_posts() seemingly ignoring post_type
- cloning a WP_Query
- Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?
- Placing a div or img in between a post array using WP Query [closed]
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Show one post per author and limit query to 8 posts
- Display featured products through custom loop in WooCommerce 3 [closed]
- Woocommerce custom loop to show all the products [closed]
- Sort by meta key on archive page
- Exclude first 5 posts of specific categories in the main loop
- How to bring specific post to front of wordpress loop?
- meta_query on a date range using an array of values
- How to display 3 different loops in 3 columns on homepage
- How is WP_Query connected to WP_Post in The Loop?
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- Query sticky posts with thumbnails
- Show all parents and children in custom post type in right order
- Why is this coming back as null? Thats wrong. There is one post
- How to show the posts of some category first, and then all other
- Why execute the_post()?
- wordpress query in header won’t reset and corrupts other loops
- How to get user_id from wordpress database inside ajax function?