Make WordPress Core

Opened 8 years ago

Last modified 5 years ago

#35758 new defect (bug)

Reading Settings fallback option when none is selected at Front page displays

Reported by: cybr's profile Cybr Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.1
Component: Query Keywords:
Focuses: Cc:

Description

Hi,

I found a bug that makes the home page think it's a page. (I didn't look at the WP_Query variables.)

Here are the steps to replicate the issue:

  1. Go to /wp-admin/options-reading.php
  2. Delete the selected option at "Front page displays" through Developer Tools/Web Inspector.
  3. Save settings.
  4. Now no setting is selected.

The home page is a Posts Page but WP_Query doesn't recognize it as one, nor as a front page at all.

This causes all kinds of issues when plugins/themes rely on is_front_page().

Thanks!

Change History (3)

#1 follow-up: @swissspidy
8 years ago

  • Component changed from General to Query
  • Keywords reporter-feedback added

Can you tell us which values were exactly saved to the database after you deleted the option using the dev tools?

Seems like an unusual use case, as a regular user probably won't ever do such a thing, but perhaps we can improve handling of such cases.

#2 in reply to: ↑ 1 @Cybr
8 years ago

  • Keywords reporter-feedback removed

Replying to swissspidy:

Can you tell us which values were exactly saved to the database after you deleted the option using the dev tools?

var_dump( get_option( 'show_on_front' ) ); // string(0) ""

Seems like an unusual use case, as a regular user probably won't ever do such a thing, but perhaps we can improve handling of such cases.

That's right! But I did handle a support question (through Facebook) regarding this situation, and I just had to test it out. The user normally writes in RTL, and uses Google Chrome. So that might be something.

It looks like this already has been handled in some way, but it fails to do anything in this scenario, I assume because of line 65 with all the && cases, at least one of them holds false.
https://github.com/WordPress/WordPress/blob/master/wp-admin/options-reading.php#L56-L67

I hope this helps!

Note: See TracTickets for help on using tickets.