aam_posts_where_clause_filter
Purpose
Change SQL conditions for AAM post filtering.
Callback
- Type: Filter.
- Arguments:
$where,$wp_query. - Return: the filtered first argument.
Example
add_filter('aam_posts_where_clause_filter', function ($where, $wp_query) {
if ($wp_query->get('myapp_limit_posts')) {
global $wpdb;
$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_author = %d", get_current_user_id());
}
return $where;
}, 10, 2);
Limits an opted-in query to the current author. Use $wpdb->prepare() for values and leave other queries untouched.
See the complete hook list.