Forked from mourique/use wordpress as cms (not blog)
Last active
November 11, 2015 09:03
-
-
Save pascalmaddin/94abe01067738d5fcd51 to your computer and use it in GitHub Desktop.
use wordpress as cms (not blog)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Kill attachment, search, author, daily archive pages */ | |
add_action('template_redirect', 'custom_template_redirect'); | |
function custom_template_redirect(){ | |
global $wp_query, $post; | |
if (is_author() || is_attachment() || is_day() || is_search() || is_category()) | |
{ | |
$wp_query->set_404(); | |
} | |
if (is_feed()) | |
{ | |
$author = get_query_var('author_name'); | |
$attachment = get_query_var('attachment'); | |
$attachment = (empty($attachment)) ? get_query_var('attachment_id') : $attachment; | |
$day = get_query_var('day'); | |
$search = get_query_var('s'); | |
if (!empty($author) || !empty($attachment) || !empty($day) || !empty($search)) | |
{ | |
$wp_query->set_404(); | |
$wp_query->is_feed = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment