Modify author archive query to combine two queries

The only way that I’ve found to override the main author archive query in a way that will include posts that aren’t created by the specified user is by using the posts_where filter.

For example:

        $post_ids = function_that_gets_desired_post_ids();

        add_filter('posts_where', function($where) use ($post_ids){

            $post_ids = array_map(function($id){
                return (int) $id;
            }, $post_ids);

            $in = implode(',', $post_ids);
            $where .= " OR (ID IN ($in) AND post_type="post")";
            return $where;

        });

Using something like this doesn’t make me feel good, but it does work.

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