Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#37423 closed defect (bug) (fixed)

Permalink for pending post - get_sample_permalink_html bug

Reported by: knutsp's profile knutsp Owned by: jorbin's profile jorbin
Milestone: 4.7 Priority: normal
Severity: major Version: 4.4
Component: Permalinks Keywords: has-patch dev-feedback
Focuses: ui, administration Cc:

Description

Steps to reproduce:

  • Create a new post, edit Status to Pending Review and press Save as Pending
  • After saved, observe the Permalink field

Expected, either:

  • No permalink yet (but a draft displays a working preview link)
  • A working link for preview post, and that the displayed URL and the actual href value on it is equal

Actual:

  • Permalink is displayed as https://example.com/2016/my-post/ (gives status 404)
  • Permalink href is actually: https://example.com/2016// (shows the yearly archive)

(Permalink settings: /%year%/%postname%/)

Attachments (3)

37423.diff (1016 bytes) - added by knutsp 8 years ago.
Makes the actual sample permalink for pending posts valid as preview link
permalink.png (51.2 KB) - added by knutsp 8 years ago.
Screenshot - invalid sample permalink
37423.test.diff (1.0 KB) - added by enshrined 8 years ago.
Test for 47423.diff

Download all attachments as: .zip

Change History (10)

#1 @knutsp
8 years ago

As a draft the permalink field displays https://example.com/2016/my-post/ and links to https://example.com/?p=123&preview=true (correct).

So it seems the displayed URL is meant to be a kind of permalink suggestion. Ok, but it's a "faked" link and feels strange and buggy. But the actual link must work, also for pending posts.

Last edited 8 years ago by knutsp (previous) (diff)

@knutsp
8 years ago

Makes the actual sample permalink for pending posts valid as preview link

#2 @knutsp
8 years ago

  • Keywords has-patch dev-feedback needs-unit-tests added
  • Version set to 4.4

37423.diff just fixes the href part and let's you preview the post when clicking. The displayed link, however, still shows an invalid permalink / preview link for posts not yet given a post_name.

I think this bug was introduced in 4.4 when this part of the screen was redesigned a bit.

Please help get this fixed.

#3 @knutsp
8 years ago

  • Component changed from Editor to Permalinks
  • Focuses ui added
  • Severity changed from normal to major
  • Summary changed from Permalink for pending post - editor bug to Permalink for pending post - get_sample_permalink_html bug

Anyone to take a look at this?

@knutsp
8 years ago

Screenshot - invalid sample permalink

#4 @knutsp
8 years ago

Hello from the other side! (Adele)

I report a bug, then try my best to make patch, but no comments or anything. I'm now feeling this is ignored. Is there some active maintainer for the Permalinks component? Or @helen? Do you want bugs reported from users?

This ticket needs a milestone, at least. Or say it's not a bug at all.

#5 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.7

@enshrined
8 years ago

Test for 47423.diff

#6 @enshrined
8 years ago

  • Keywords needs-unit-tests removed

I've attached a test for posts that contain no post_name to make sure they instead use the preview link rather than a broken permalink. This test passes with the previous patch (37423.diff) but fails without.

Also realised my message for the test had the wrong ticket number in it, apologies.

#7 @jorbin
8 years ago

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

In 38572:

Permalinks: Ensure Pending Review Posts permalink posts link to the draft

[34670] made the displayed permalink clickable. For posts that were pending review, the permalink wasn't being properly generated so the link wouldn't go to the preview.

Props knutsp, enshrined.
Fixes #37423.

Note: See TracTickets for help on using tickets.