[wp-trac] [WordPress Trac] #17609: 'View post' link shown even when post type can't be viewed on the front-end

WordPress Trac noreply at wordpress.org
Thu Aug 20 19:39:59 UTC 2015


#17609: 'View post' link shown even when post type can't be viewed on the front-end
-------------------------------+-----------------------
 Reporter:  scribu             |       Owner:
     Type:  defect (bug)       |      Status:  assigned
 Priority:  normal             |   Milestone:  4.4
Component:  Posts, Post Types  |     Version:  2.9
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:
-------------------------------+-----------------------

Comment (by wonderboymusic):

 In [changeset:"33666"]:
 {{{
 #!CommitTicketReference repository="" revision="33666"
 Custom Post Types:

 * Introduce `is_post_type_viewable( $post_type_object )`
 * Separate the HTML bits from the translatable bits in the `post` messages
 array in `edit-form-advanced.php`
 * Don't show certain UI pieces when a post is not viewable on the front
 end

 When a custom post type item is not viewable on the front end, we don't
 want to show links to View it (on the front end) all over the admin. We
 also want to hide the Preview link, et al. We also want our admin messages
 to not contain said links.

 Custom post types with `public_queryable` set to `false` are not viewable
 on the front end.
 `'page'` is viewable on the front end, but `'page'` is a `_builtin` type,
 and `public_queryable` is set to `false` when it is registered - see
 `WP::parse_request()` for when `public_queryable` gets used.

 This is confusing, but also somewhat straightforward: to determine if a
 post type is viewable on the front end, we can check one way for `_builtin
 => true` and another way for `_builtin => false`:

 `$post_type->publicly_queryable || ( $post_type->_builtin &&
 $post_type->public )`

 If a post type is `publicly_queryable`, it's viewable. If that value is
 `false`, it is viewable if it's a `_builtin` type that is also `public`.

 I am in search of edge cases, so this shall land.

 Props wonderboymusic, DrewAPicture.
 See #17609.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/17609#comment:49>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list