Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#45894 new defect (bug)

is_home conditional tag returns incorrect value with home pagination

Reported by: man4toman Owned by:
Priority: normal Milestone: Awaiting Review
Component: Query Version: 5.0.2
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

I create a index page with simple posts loop that paginate with 'the_posts_pagination' function, in default index 'is_home' returns true but when I navigate to page 2, 'is_home' returns true again!

The reading options is set on default values.

I check $wp_query in these 2 page, when 'is_page' is true we aren't in home.

So I add this condition and create the patch.

Attachments (2)

is_paged.png (23.2 KB ) - added by man4toman 8 years ago.
Compare the $wp_query in 2 page
class-wp-query.php.patch (935 bytes ) - added by man4toman 8 years ago.
The patch

Download all attachments as: .zip

Change History (5)

@man4toman
8 years ago

Compare the $wp_query in 2 page

@man4toman
8 years ago

The patch

#1 @man4toman
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Summary is_home conditional tag returns incorrect value with index paginationis_home conditional tag returns incorrect value with home pagination

#2 @ChriCo
8 years ago

The naming of those conditional functions are quiet irritating, but i would say, that your patch is a breaking change to WordPress.

The is_home indicates, if the query is for the blog homepage. Which is for page 1 and page n correct, because you're still running the "home"-query when you're on page 2, just with an LIMIT/OFFSET.

#3 @man4toman
8 years ago

Hi @ChriCo
I agree with you and also thought about this.

But if we consider the function's name, the is_home function should only be for the first page even in blog mode.

Unless we must change the name of is_home to is_blog_home or something like this to prevent this misunderstanding.

Totally we must conclude in this case.

Note: See TracTickets for help on using tickets.