You should use a custom select query:
$querystr = "
SELECT * FROM $wpdb->posts
LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)
WHERE ($wpdb->terms.name="sounds-flavors" OR $wpdb->posts.ID IN(12345,12678))
AND $wpdb->term_taxonomy.taxonomy = 'category'
AND $wpdb->posts.post_status="publish"
AND $wpdb->posts.post_type="post"
LIMIT 3
";
Take a look here: https://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query
Regards
Related Posts:
- The next_posts_link() works only with original $wp_query
- Skipping first 3 posts in wp query
- posts page – different lengths of excerpt
- Pagination not working on Custom Page Template
- Specific loop in Shortcode
- how to show all post in my page-grid.php template page
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- Hide Post comments when displayed via WP_Query
- WP_Query do not load specifed number of post
- Single post as homepage?
- How can I pass the ID of a post to a page template by clicking a url?
- How to insert 2 args into 1 Wp_Query for a slideshow
- Switch to page template when using post permalink
- What’s the best way to render Visual Composer in posts, not pages?
- Get Page ID of blog homepage
- Using wp_list_pages() after calling query_posts()
- How to get ID of the page included with get_page()?
- Why won’t pagination work?
- Shortcode with ‘year’ parameter
- WordPress 302 Redirect to Random Product/Post/Page
- How to convert query sql to shortcode in wordpress?
- HTML Inside of Shortcode Breaks Shortcode Output
- post/page content
- Prevent 404 of Author pages without posts
- Change published date and time using SQL query for page in every 5 hour
- Function is printing twice – any suggestions?
- How to create page with post content in it?
- Page with Category Returning 1
- Single Sidebar; multiple templates! How?
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- Using Post ID and Page ID in same function
- How to arrange different post categories in template
- The next_posts_link() works only with original $wp_query
- how to style an individual page in a category [duplicate]
- Redirecting posts in WordPress to a specific page
- Limit amount of pages shown in pagination within wp_query
- How do I add an article to specific page?
- custom post type single page template not working
- WordPress “Posts Page” isn’t showing template dropdown
- Insert Shortcode exactly at the end of the content
- Trying to create shortcode listing custom posts, but formating not being included
- How can I show many posts an author has per week?
- How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?
- do_shortcode within post query
- Ajax load more button in Recent posts widget
- Create posts under certain page
- WP_Query with ajax handler returns the same posts
- WP_Query orderby not working with meta_value_num and menu_order
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Custom WP_Query with complex ‘post_status’ argument
- How can I sort posts by the date and a custom meta field?
- How do I get blog posts to appear within CMS?
- Multiple loops are not reset
- is there a way to show the the post title after the image?
- How to get rid of shortcodes in post content once and for all
- Should I use posts or pages in this scenario?
- recent posts for different categories
- Drag posts and pages so you can sort them in order
- get_the_content(“more…”) returns full text
- Add Word Limit to Posts
- Why aren’t my posts/pages showing up in my WordPress Theme?
- How to include the latest post of a specific category on a matching page
- Is there a straight-forward way to iterate over all shortcodes in a post?
- post categories
- Using custom post template
- Search by post title and content in wp_query without order
- How can i display gallery shortcode output under Post text
- Hiding Draft Post In Admin
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- What is the filter or hook to add admin controls to posts on the front end?
- How to display Common posts from specific Tag & Category with Shortcode
- Setting posts_per_page for taxonomy term template
- Blog post per page setting conflicting with custom WP_Query?
- Change post order random through out the entire WordPress
- How to exclude latest x posts from a paginated query?
- Setup a custom dynamic post
- Adding buttons to Add New Post and Add New Page
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- How to verify wp user password by sql query in wp? [closed]
- Removing noindex posts from wp_query
- WP Query – Posts Per Page not working in combination with category__in
- Ajaxify This Code
- How to filter my search in post if contains a word in title, content or excerpt?
- How to return another post than requested
- Pausing and Resuming WP_Query results
- How to do set post permalinks using 6 digit random unique function?
- Select only post id and meta value with WP_Query
- Lost draft under all posts and drafts
- Post categories to pages
- Get user categories with most posts in it
- 301 (static page instead latest posts)
- Integrate OpenStreetMap on WordPress
- Genesis + Ajax + Jquery | Failling to call action
- Random ajax load only works with posts_per_page set to -1
- How to : pagination in 3 different custom loops on the same page
- How to handle broken links created by permalink/slug changes?
- display-posts shortcode attributes have no effect
- Shortcode and whitespace formatting problem
- Send post id through ajax and get the post content back
- Static posts page with home.php