public
Created

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?php
 
add_action( 'pre_get_posts', 'be_author_query' );
/**
* Limit Author Archive by Meta Value
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function be_author_query( $query ) {
 
if( $query->is_main_query() && $query->is_author() ) {
$meta_query = array(
array(
'key' => 'be_include_in_archive',
'value' => 'yes',
)
);
$query->set( 'meta_query', $meta_query );
}
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.