WP Query – Search in title or author_name

EDIT : Sorry just read that you need a ‘OR’ in your query. I will update anwser soon.

According to your question, you can try this code.

// WP_Query arguments
$args = array(
    'name'                   => 'test',
    'author_name'            => 'test',
);

// The Query
$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
        $query->the_post();
        // do something
    }
} else {
    // no posts found
}

// Restore original Post Data
wp_reset_postdata();

In the arguments, you should check if the parameters fits your needs :

  • 'name' : Display post by slugs
  • 'author_name' : Display posts by author ‘user_nicename’

If you need help building your query, you should definetly refer to theses links :

Hope it help!