[wp-trac] [WordPress Trac] #37530: is_front_page() is based on wrong data -> gives wrong results
WordPress Trac
noreply at wordpress.org
Sun Jul 31 14:28:50 UTC 2016
#37530: is_front_page() is based on wrong data -> gives wrong results
--------------------------+-----------------------------
Reporter: TheInfinity | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.5.3
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
1) is_front_page() is based on the SQL query, so it always gives back
false when you try to use it eg at pre_get_posts. If it has no way to
figure it out if it's the front page or not, it should return null instead
2) is_front_page() in themes gives the wrong result false back when you
set an static page for the front page and then modify the main query on
start page to posts or any other custom post type except page. This forces
you to make an additionally SQL query instead of using the main query to
build a custom front page.
Both is because of this:
https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-
includes/query.php#L4458 . This does not really make sense to get the
front page.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37530>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list