[wp-trac] [WordPress Trac] #10822: Post page is 404 when no post found on static page for homepage
WordPress Trac
wp-trac at lists.automattic.com
Mon Sep 21 10:13:42 UTC 2009
#10822: Post page is 404 when no post found on static page for homepage
--------------------------+-------------------------------------------------
Reporter: v.guerard | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Query | Version: 2.8
Severity: normal | Keywords: is_posts_page
--------------------------+-------------------------------------------------
On front page configuration, I specify 2 static pages, one for homepage
(ex: page1), and another for posts page (ex: page2).
If I have no post, page2 is like a 404 page.
The $wp_query is well parsed, but on handle_404() call, no test on
$wp_query->is_posts_page flag is available (like category or tag query).
The handle_404 test change the $wp_query setting and it's not possible to
know if we are in posts_page or not(is_404 = true and is_posts_page =
false).
is_post_page is not used a lot in the source code, I haven't found an
is_posts_page() global function.
So we can had it :
'''function is_posts_page() {'''
'''global $wp_query;'''
'''return ($wp_query->is_posts_page);'''
'''}'''
and in handle_404 of wp-includes/classes.php (line 464 on 2.8) change the
line
if ( ( is_tag() || is_category() || is_author() ) &&
$wp_query->get_queried_object() ) {
by
if ( ( is_tag() || is_category() || is_author() || '''is_posts_page()''')
&& $wp_query->get_queried_object() ) {
It's seem that the problem is only available with this configuration. No
problem if I use same homepage and post_page.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10822>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list