Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#56840 closed defect (bug) (fixed)

The permalink format is "plain" by default

Reported by: strategio's profile strategio Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.1 Priority: normal
Severity: normal Version: 6.1
Component: Permalinks Keywords: has-patch has-unit-tests commit dev-reviewed
Focuses: Cc:

Description (last modified by sabernhardt)

In the previous WP versions, the permalink format was set to "Day and name" by default.

Steps to reproduce

  • Start from scratch
  • Complete the WP install wizard
  • Go to Settings > Permalinks

=> With WP 6.0.2, it's set to "Day and name"
=> With WP 6.1 RC1, it's set to "Plain"

Notes

It's not really causing issue to us, but we have an end-to-end test that assumes the permalinks are set to "Day and name" and it started failing as soon as we ran it with WP 6.1 RC1.

So this might be a hint that something is wrong in WP 6.1 RC1 (or maybe it's on purpose).

Attachments (2)

56840.diff (603 bytes) - added by SergeyBiryukov 2 years ago.
56840.2.diff (1.2 KB) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (13)

#1 @sabernhardt
2 years ago

  • Component changed from General to Permalinks
  • Milestone changed from Awaiting Review to 6.1
  • Version set to trunk

#2 follow-up: @sabernhardt
2 years ago

The Permalink Settings page had several changes for the upcoming release, but I was able to get the same results without visiting that page. The default schema.php setting has been blank for years, so the installation process set "Day and Name" pretty permalinks somewhere else in earlier sites (and now that doesn't work).

Steps I took for 6.0.2 and 6.1-RC1:

  1. Download WordPress .zip package.
  2. Unzip files, add them in local server directory, create a database, and create a wp-config.php file.
  3. Complete the WordPress install process for a single site (not network).
  4. Visit the Posts listing page, and check the URL on the "Hello World" post's View link.

6.0.2 URL: http://localhost/wp60a/2022/10/17/hello-world/
6.1-RC1 URL: http://localhost/wp61a/?p=1

Last edited 2 years ago by sabernhardt (previous) (diff)

#3 @sabernhardt
2 years ago

  • Description modified (diff)

#4 in reply to: ↑ 2 @SergeyBiryukov
2 years ago

Replying to sabernhardt:

The Permalink Settings page had several changes for the upcoming release, but I was able to get the same results without visiting that page. The default schema.php setting has been blank for years, so the installation process set "Day and Name" pretty permalinks somewhere else in earlier sites (and now that doesn't work).

Right, pretty permalinks are conditionally enabled in wp_install_maybe_enable_pretty_permalinks() if the server supports that.

#5 @desrosj
2 years ago

  • Summary changed from [WP 6.1 RC1] The permalink format is "plain" by default to The permalink format is "plain" by default

#6 follow-up: @dlh
2 years ago

wp_install_maybe_enable_pretty_permalinks() looks for the `X-Pingback` header to determine whether a post is accessible at a "pretty" URL. In [54250], the logic for sending the X-Pingback header was moved to WP::send_headers(), but that logic relies on $wp_query, which isn't globalized in send_headers() (unlike in WP::handle_404(), where the logic used to be). A global $wp_query looks like it'd be enough to address the issue.

@SergeyBiryukov
2 years ago

#7 in reply to: ↑ 6 @SergeyBiryukov
2 years ago

  • Keywords has-patch needs-unit-tests added
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

Replying to dlh:

In [54250], the logic for sending the X-Pingback header was moved to WP::send_headers(), but that logic relies on $wp_query, which isn't globalized in send_headers() (unlike in WP::handle_404(), where the logic used to be). A global $wp_query looks like it'd be enough to address the issue.

Great catch, thanks!

#8 @SergeyBiryukov
2 years ago

  • Keywords has-unit-tests commit dev-feedback added; needs-unit-tests removed

56840.2.diff includes a unit test.

This ticket was mentioned in Slack in #core by chaion07. View the logs.


2 years ago

#10 @davidbaumwald
2 years ago

  • Keywords dev-reviewed added; dev-feedback removed

LGTM. Thanks for working on this Sergey!

#11 @SergeyBiryukov
2 years ago

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

In 54636:

Bootstrap/Load: Correct sending the X-Pingback header in WP::send_headers().

The logic for sending the X-Pingback header for single posts that allow pings was recently moved from WP::handle_404()​ to a more appropriate place in WP::send_headers().

To check whether pings are open for a particular post, that logic relies on the $wp_query global, which is declared in WP::handle_404(), but not in WP::send_headers()

This commit ensures that $wp_query is globalized in WP::send_headers() too, so that the check works as expected.

Follow-up to [54250].

Props strategio, sabernhardt, dlh, davidbaumwald, SergeyBiryukov.
Fixes #56840.

Note: See TracTickets for help on using tickets.