Order by summing multiple values

I wouldn’t use taxonomies or custom fields for this purpose. Every time you’re add one custom field for a query, you have to add a JOIN part for that query – it means that with 10-15 custom fields, you’ll get query with 10-15 joins – so such query will be very slow. But there is … Read more

Including metaboxes from custom post types in global search — continued

I’ve figured out a fix. First, to fix bad results for an empty search, I require that (!empty(get_query_var(‘s’)) Before setting the “meta_query” query variable in my plugin. I thought the fix would be with the posts_request filter, but it continued to replace select SQL_CALC_GET_ROWS wp_posts.ID with select SQL_CALC_GET_ROWS wp_posts.* Even when I replaced the * … Read more

get all posts in custom post type by ACF field value

Meta Queries are nested arrays. See the WP_Query section on meta queries. Option 1 Use meta_key and meta_value directly in the query arguments, not as a meta query. $student_query_args = [ ‘post_type’ => ‘student_list’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 100, ‘order’ => ‘DESC’, ‘meta_key’ => ‘program_id’, ‘meta_value’ => 5317, ]; Option 2 The meta query … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)