Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created February 9, 2012 03:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save billerickson/1776948 to your computer and use it in GitHub Desktop.
<?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 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment