Get posts that match defined arrays of tags

This should be achievable with a taxonomy query, like this: $query = new WP_Query( [ ‘tax_query’ => [ ‘relation’ => ‘AND’, [ ‘taxonomy’ => ‘post_tag’, ‘terms’ => $platforms, ‘compare’ => ‘IN’, ], [ ‘taxonomy’ => ‘post_tag’, ‘terms’ => $hashtags, ‘compare’ => ‘IN’, ], ], ] ); You just need to substitute the $platforms and $hashtags … Read more

Get posts for each user

According to the WP_Query::parse_args docs (which is what parses the $args you’re passing to get_posts()), the $author parameter needs to be an int or a string (a comma-separated list of IDs). But you’re also going to need this set up in groups, per student, so here’s what I’d recommend: use an array to store each … Read more

pre_user_query vs pre_get_posts

The pre_get_posts function is a simple query modifier for general “post” queries. If you’re looking to modify the SQL directly for these query I suggest using the post_clauses hook. This hook passes an array of SQL clauses such as: $sql[‘where’] and sql[‘join’] Here you can inject your own custom SQL into the specific clauses. That … Read more

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