elin-r
2/17/2017 - 1:04 PM

Redirect all but pages

Redirect all but pages

function wpa_parse_query( $query ){
    if( ! is_admin() && ! $query->is_page() ) {
        wp_redirect( home_url() );
        exit;
    }
}
add_action( 'parse_query', 'wpa_parse_query' );
https://codex.wordpress.org/Conditional_Tags