I'm trying to show aditional posts in the author's page. This page must have posts containing a specific meta_key and meta_value, where the displayed author it is not really the WP post's author.
This is the function I have:
function my_pre_get_posts( $query ) {
if ( is_admin() )
return;
if ( $query->is_main_query() ) :
if ( is_author() ):
$query->set( 'meta_query', array(
'relation' => 'OR',
array(
'key' => 'writer',
'value' => 'the same author name'
),
array(
'key' => '',
'value' => ''
)
) );
endif;
endif;
}
add_action( 'pre_get_posts', 'my_pre_get_posts' );
But at a glance, it won't work.
Sorry if my english is bad.
key = 'the same author name' OR key = NULL, but not return posts wherekey = 'other author name'? – Andy Adams Dec 5 '12 at 19:02