Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24139 closed defect (bug) (fixed)

Don't show "Preview" for locked, non-public post types

Reported by: batmoo's profile batmoo Owned by: nacin's profile nacin
Milestone: 3.6 Priority: normal
Severity: minor Version: 3.6
Component: Posts, Post Types Keywords: has-patch needs-testing commit
Focuses: Cc:


If a post_type is not public but has show_ui => true, we shouldn't show the preview link on the "This content is currently locked" notice.

Attachments (1)

24139.diff (2.1 KB) - added by aaroncampbell 11 years ago.

Download all attachments as: .zip

Change History (11)

#1 @johnbillion
11 years ago

The 'Go back' button needs fixing too. There may not be a referer if you've gone directly to the editing screen or opened it in a new tab, and the referer may be the same as the current page in the case where you've previously made a save and someone has just taken over.

#3 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.6

#4 @aaroncampbell
11 years ago

It looks like we show a preview link in the update notice in this same situation (public=>false, show_ui=>true), but it 404s.

11 years ago

#5 @aaroncampbell
11 years ago

Regarding my previous comment, it looks like you can use the post_updated_messages filter to add your own custom updated messages for your post types. I think this is sufficient for someone to remove the preview link if they want. If we wanted to handle this automatically we could, but it didn't seem as necessary there.

It also looks like this should be based on publicly_queryable not public. 24139.diff does just that. It hides the preview button by default if the post type is not publicly_queryable. I also leaves in the preview_post_link filter even for those post types, so you could override this if you wanted by using that filter to return a preview URL.

#6 @aaroncampbell
11 years ago

  • Keywords has-patch needs-testing added

#7 @markjaquith
11 years ago

  • Keywords commit added

24139.diff works for me with a non-public CPT I tested.

#8 @nacin
11 years ago

publicly_queryable is an odd one. pages have it set to false, ostensibly because you can't do ?post_type=page and expect to get back a list of pages. public is much safer.

#9 @markjaquith
11 years ago

Confirmed that public is how we do it for the Publish meta box.

#10 @nacin
11 years ago

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

In 24799:

Don't show "Preview" for locked, non-public post types. props aaroncampbell. fixed #24139.

Note: See TracTickets for help on using tickets.