WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 16 months ago

#20098 closed defect (bug) (invalid)

Non-publicly queryable posts should not allow preview

Reported by: tamlyn Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: General Keywords: dev-feedback 2nd-opinion
Focuses: Cc:

Description

Custom post types which have publicly_queryable=false but show_ui=true should not show a preview button in the admin. Similarly, the slug editor should also be hidden and the 'View post' link should not be displayed in the published message.

Looking at the core code, it seems to be a simple matter of updating it to look at the publicly_queryable property instead of the public meta property.

If approved, I can have a go at creating a patch.

In the meantime, attached is a bit of PHP which modifies the output buffer to achieve the same result.

Attachments (1)

remove-preview.txt (580 bytes) - added by tamlyn 2 years ago.
Remove preview button

Download all attachments as: .zip

Change History (6)

tamlyn2 years ago

Remove preview button

comment:1 follow-up: nacin2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

comment:2 in reply to: ↑ 1 johnbillion2 years ago

  • Keywords dev-feedback 2nd-opinion added

Replying to nacin:

http://core.trac.wordpress.org/ticket/19920#comment:1

I don't understand this counter-argument. 'public' is a meta property. We shouldn't be using its value to determine behaviour. If publicly_queryable isn't a suitable property to use to determine if a post type can be viewed at its permalink then we need another property for this purpose.

comment:3 follow-up: nacin2 years ago

public isn't a meta property. While other properties inherit from it, it has its own purpose as well.

http://core.trac.wordpress.org/ticket/17040#comment:24

If publicly_queryable isn't a suitable property to use to determine if a post type can be viewed at its permalink then we need another property for this purpose.

I would like to hear the use case (in a new ticket).

comment:4 in reply to: ↑ 3 johnbillion2 years ago

Replying to nacin:

public isn't a meta property. While other properties inherit from it, it has its own purpose as well.

Looks like the Codex and the inline docs need some clarification. The Codex gives the impression this is a meta argument which only sets the default values of other arguments. The inline doc is incorrect altogether.

If publicly_queryable isn't a suitable property to use to determine if a post type can be viewed at its permalink then we need another property for this purpose.

I would like to hear the use case (in a new ticket).

Will do.

Note: See TracTickets for help on using tickets.