Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
My Function Conditional Tags
function my_function() {
if ( !is_admin() && $query_>is_main_query() ) {
// contents of function go here
add_action( 'pre_get_posts', 'my_function');

This comment has been minimized.

Copy link

@mabras mabras commented Jun 28, 2015

Line 4 should be: if ( !is_admin() && $query->is_main_query() ) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment