Skip to content

@jazbek /gist:4525380
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// sfw endpoint
add_action( 'init', 'add_sfw_endpoint' );
function add_sfw_endpoint()
{
add_rewrite_endpoint( 'sfw', EP_ALL );
}
add_action( 'pre_get_posts', 'sfw_pre_get_posts' );
function sfw_pre_get_posts($query)
{
global $wp_query;
if (isset($wp_query->query_vars['sfw']))
{
$query->query_vars['tax_query'][] = array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => 'nsfw',
'operator' => 'NOT IN',
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.