Skip to content

Instantly share code, notes, and snippets.

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

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