WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#12737 closed defect (bug) (fixed)

is_front_page issue with no pages

Reported by: Connorhd Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.2
Component: General Keywords: dev-feedback has-patch
Focuses: Cc:

Description

With no published pages the setting "show_on_front" is removed when the reading settings are changed, this causes show_on_front to always return false.

Attachments (3)

13846.2.diff (417 bytes) - added by Connorhd 5 years ago.
13846.diff (417 bytes) - added by Connorhd 5 years ago.
12737-hidden.diff (728 bytes) - added by sivel 5 years ago.
When no pages are present add a hidden input field so that the option is not blanked

Download all attachments as: .zip

Change History (7)

@Connorhd5 years ago

@Connorhd5 years ago

comment:1 @jane5 years ago

  • Milestone changed from Unassigned to 3.0

comment:2 @sivel5 years ago

  • Cc matt@… added
  • Keywords dev-feedback added

I think we are trying to patch the wrong thing here. The is_front_page function does the following check:

        // most likely case
        if ( 'posts' == get_option('show_on_front') && is_home() )
                return true;

That logic should catch this scenario. If it isn't then we need to find out what show_on_front is not set as 'posts' here and patch the code responsible for that failure.

@sivel5 years ago

When no pages are present add a hidden input field so that the option is not blanked

comment:3 @sivel5 years ago

  • Keywords has-patch added

New patch adds a hidden input field to options-reading.php when no published pages are present. This saves options.php from blanking show_on_front when saving.

Viper007Bond and I discussed fixing this for backwards compat and without the user going to options-reading.php and clicking "Save Changes" the option will still remain blank. I am open to suggestions, but really feel that fixing it in the is_front_page logic is the wrong place.

comment:4 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14362]) When no pages are present add a hidden input field so that the show_on_front option is not blanked. Fixes is_front_page return value in an edge case. props sivel, fixes #12737, fixes #9105.

Note: See TracTickets for help on using tickets.