rep__employee_id__in
rep__employee_id__in is a custom query parameter used in the Malcolm HQ system to filter and retrieve employee posts based on their associated employee ID.
Product
How it Works
In Malcolm HQ, rep_employee is a custom post type that represents employees. The rep__employee_id__in parameter allows efficient retrieval of rep_employee posts based on a list of associated employee IDs.
Unlike standard WordPress meta queries (meta_query), which rely on wp_postmeta, this parameter queries a custom database table, making filtering significantly more efficient. Since the data is stored in a custom table, filtering is optimized for performance and does not require additional meta_query conditions.
Accepted Values
rep__employee_id__in accepts an array of employee IDs:
- Array of integers – An array containing employee IDs that should be included in the results.
Usage
You can use rep__employee_id__in in your WP_Query arguments to retrieve specific rep_employee posts associated with specific employee IDs.
Example
$args = array(
'post_type' => 'rep_employee', // Custom post type.
'rep__employee_id__in' => [123, 456, 789], // Filter by employee IDs.
);
// Execute the query and retrieve results.
$query = new WP_Query( $args );
The query will retrieve rep_employee posts where the employee_id matches any of the provided IDs (123, 456, or 789). |