If you only have two types (directors and none directors and you allready get all of the directors you can simply use the post__not_in
parameter, ex:
// Get your directors just like you do now
// $directors = get_posts(array( ...
// Then create a simple array with only the post id's of the directors.
$directors_ids = array();
foreach($directors as $d)
$directors_ids[] = $d->ID;
//then you can get all of the people who are not directors using:
$people = get_posts(array(
'post_type' => 'people',
'orderby' => 'meta_value',
'meta_key' => 'last_name',
'order' => 'ASC',
'posts_per_page' => -1,
'post__not_in' => $directors_ids
)
);
Related Posts:
- Mixing regular and custom post types (with meta_query) on home page
- WP_Query() show posts that end later than today
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Using Query Posts With Multiple Post Types And A Taxonomy
- Can’t sort order of wp_query with 2 meta keys
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Combine tax_query and meta_query in WP_Query
- query order by date on custom type: wrong order
- exclude custom post type by meta key in wp_query
- Filter posts with meta_query NOT IN where value has multiple values
- Filtering by Post Meta Custom Fields – Performance
- Is it possible to apply a meta_query to one specific post type in a query with multilple post types?
- Setting proper query for multiple custom admin filters
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Why is this query not working? (Standard posts + custom post type)
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- WP_query – Filter by tax_query and meta_query using multiple select
- Getting a custom post’s custom field based on another custom post’s custom field select
- find custom post type post by searching its custom field with my string
- WP_Query of custom post type sorted by meta_key has unexpected results
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Query Posts, order by meta value
- WP_Meta_Query object with conditionals
- Sorting by meta_key different to search criteria?
- Using WP meta query to show custom post types by a start and finish date
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- build child and anchestor three from post parent
- meta query condition don’t work
- Custom query result empty on page 2
- Use WP_query to match post types based on custom field values
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- post type => ‘any’ not applied my custom queries
- How to get the posts that my following users are liked?
- Meta_Query refuses to return results
- Not able to get my custom search result using meta_query and tax_query together?
- Querying, storing, and using data from 2 separate custom post types
- Query events post type after current date and timezone
- Conditional posts in WP_query for search
- Selecting posts older than the current Unix epoch timestamp
- Custom Query With Multiple Meta Key Value
- Trying to combine multiple WordPress queries
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Order Wp Query by earliest of 3 dates meta query
- WP_Query() displaying past post / event
- WP Query Conditionally query meta and taxonomy
- Meta query with boolean true/false value
- Get Posts in a Custom Post Type category
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Querying Posts by Taxonomy From Alternate Network Site
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Query for posts in 2 taxonomies
- Display custom post types with custom date field value (before today) & order by custom date field
- Parent / Child formatting in a list of post of a custom post type
- How do I create an archive page for standard posts?
- showing custom post types of a certain category only
- Query Multiple Custom Posts by Custom Fields
- Custom taxonomies relationship
- search suggest – filter post type
- WP_Query orderby and tax_query
- Different Ways to Query Custom Post Types?
- Wrapping x posts in html without leaving empty html
- Loop for custom post types filtered by a taxonomy
- how to get this tax_query working?
- wordpress lists similar type of posts in a custom post type
- Custom post type and custom taxonomy 404 on page 2
- All blog posts are not showing up
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Custom post-type custom query – show all posts
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Filter posts by their related field’s custom field
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- How do I get all authors posts of a custom post type outside loop
- minimize wp_query call to database
- sorting in wp query based on custom field value
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- WordPress loop add heading before first of type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- WP_Query for CPT with filter by another WP_Query
- Is it possible to add query parameters on the archive page?
- Shortcode display CPT Query only showing 1 post?
- Query stopped working
- WP_Query and two custom fields returns no posts
- Storing/querying custom date data
- Custom Post-type not returning the right child_of
- How do I hide single category post on my post page