Maybe this could help and should return any post either in 2, 3 or 4 category AND in categoery 1 :
query_posts( array( 'cat' => array(2,3,4), 'category__and' => 1, 'posts_per_page' => 1, 'orderby' => 'title', 'order' => 'DESC' ) );
(from codex http://codex.wordpress.org/Function_Reference/query_posts)
Not quite sure, haven’t tested it.
Related Posts:
- Alter query on edit.php
- my function doesn’t return my post from today
- Get stock by custom meta field on all Woocommerce variable products
- PHP -> SQL Query with Summing
- How to hide posts of a specific custom category in WordPress?
- Why my query does not run with prepare
- mySQL queries are executed twice on wordpress website
- Build A Custom SQL Query for WordPress Search
- Category Page Displaying all Pages
- Trying to exclude posts from a category on the home page
- Hide empty categories from get_categories
- SQL query to retrieve the number of WordPress posts with all given categories
- Exclude a category ID from the following function
- What does the token %1$s in WordPress represent [closed]
- exclude multiple terms using get_terms() function
- wpdb::prepare was called incorrectly
- How to auto login user again after change user_login
- count number of user comments with a specific comment meta value
- Add custom field to attachments in a specific category
- Display all posts in current category
- How to display related posts from parent category
- How can I set custom order use this function
- Display related products with custom output
- Check if Product is in a Specific Category in Functions.php
- Multiple choice in a custom taxonomy
- Category Thumbnail Display – How to display ONLY the main Category
- Transferring working local PHP site to wordpress – with database (MySQL)
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- Display fields as values in array from external SQL DB
- query in category.php repeats itself
- WordPress 3.2 query_posts and pagination, permalinks issue
- Detect session/cookie variable in wordpress to prevent access to documents
- only show container with next/prev links if they exist?
- Grab posts by multiple categories
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Long running queries
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Display category name only once inside loop
- register_taxonomy() take much queries
- how to show only specific category for a template
- Odd / Even posts add class minus first post
- Edit the_category (); for a hierarchical display
- How to add div blocks after certain set of post
- Displaying posts based on category
- How do I remove a category from a wordpress loop>
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- WordPress query undefined offset in loop
- Use $wpdb or other PHP script method to find/replace in WP database
- Issue with custom loop in Archive page
- Parse error: syntax error, unexpected ‘}’ [closed]
- How to separate categories with commas?
- Show all tags within a category?
- Alphabetically Ordered Category in WordPress
- Loading Posts & Category with Ajax
- How to get current category
- WooCommerce: Display product categories to make IF statement
- Trying To Get Child Categories To Show, Issue With foreach Loop
- How to get thumbnail with pure PHP in a WordPress database?
- Show parent categories of the current category
- How to check if a category has a parent and child categories?
- Get category id when SEO URL is turned on
- wordpress sql posts query won’t display the latest post in a specific category
- Query pulling a single post per month
- SQL error with custom query
- Advanced Query posts
- Add Custom Category Description When Empty
- How can I check that the acf field value is not a duplicate when adding a post?
- Add a product category to a specific product via a button
- WordPress SQL Prepare
- My Custom Post Type AJAX Query is Returning no posts – why?
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- How to Link to category titles if it is in the single post content?
- How can i show specific Category List?
- How to show category just on specific pages?
- Collect all events in one year
- How to filter specific element of an array in wordpress/php?
- getting the values of hidden inputs to use them in a php mysql query
- Query doesn’t display text data with apostrophes
- How to make a parent page for author.php?
- Getting error in sql query
- user update profile for custom code
- List categories assigned to a post
- SQL Query Search page
- Unable to get Post Category Name and URL
- How to enqueue assets only on queried pages, excluding the page being queried?
- Trying to see if page is category or single and displaying title with appropriate heading tag
- How to export database correctly for local to online
- !in_array doesnt recognize category
- How to change links in the 3 main categories, on widget category, to a javascript function call
- how to set category name for a post
- wp_query on search results page showing all results every time
- How to create categories out of a list of words?
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- Can WordPress support Website (19GB database) Should I move Our WordPress Website to a custom one using Laravel or any other PHP framework?
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Get category name of current post (CPT UI)
- Three different queries on same page
- How to sort search result by post_title, then by post_content