WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13830 closed defect (bug) (fixed)

Front page displays: Fix same static page warning

Reported by: zeo Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

Front page display-> static page; if you choose same page for both Front page and Posts page a warning message will appear.

But if you choose static page without selecting a page for Front page, Posts Page and use the default "--Select--" for both, no warning message displayed. This will cause error, since the value for page_on_front will 0 but page_for_posts is set with no value. Warning message should be displayed.

Adding option_none_value=0 to wp_dropdown_pages will solve the issue.

Attachments (2)

13830-warning_static-pages.diff (1.6 KB) - added by zeo 4 years ago.
Fix warning for same page static page
13830.diff (2.8 KB) - added by nacin 4 years ago.

Download all attachments as: .zip

Change History (8)

zeo4 years ago

Fix warning for same page static page

comment:1 zeo4 years ago

Perhaps should include these in wp-admin/includes/schema.php too:

// 3.0
'page_for_posts' => 0,
'page_on_front' => 0,

nacin4 years ago

comment:2 nacin4 years ago

  • Keywords commit added

Attached diff takes zeo's patch a bit further.

The reason why no warning showed up in the admin was because only one was getting sanitized as an integer. Since we're now going to use show_option_none => 0, sanitizing it won't help any, but since I caught it, we might as well also sanitize it (a review we need to do in a future release more thoroughly).

I also added a little code to catch bad values and fix them when showing options-reading (thus after saving). It does it silently, but I think that is perfectly acceptable for now.

comment:3 nacin4 years ago

Of note, the code to fix the bad show_on_front value (bad when both of the options are 0) is required to fix the notice.

comment:4 wpmuguru4 years ago

(In [15224]) fix warning when page on front missing, see #13830

comment:5 nacin4 years ago

[15224] only band-aids the real problem; a lot of WP_Query will likely be confused on that page view.

comment:6 nacin4 years ago

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

(In [15227]) Fix warnings related to static pages. props zeo for initial patch. fixes #13830.

Note: See TracTickets for help on using tickets.