クラス WP::handle_404()
2014/11/29
クラス WP::handle_404()
定義ファイル :/blog/wp-includes/class-wp.php 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | public function handle_404() { global $wp_query; // If we've already issued a 404, bail. if ( is_404() ) return; // Never 404 for the admin, robots, or if we found posts. if ( is_admin() || is_robots() || $wp_query->posts ) { status_header( 200 ); return; } // We will 404 for paged queries, as no posts were found. if ( ! is_paged() ) { // Don't 404 for authors without posts as long as they matched an author on this site. $author = get_query_var( 'author' ); if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) { status_header( 200 ); return; } // Don't 404 for these queries if they matched an object. if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) { status_header( 200 ); return; } // Don't 404 for these queries either. if ( is_home() || is_search() || is_feed() ) { status_header( 200 ); return; } } // Guess it's time to 404. $wp_query->set_404(); status_header( 404 ); nocache_headers(); } |