Make WordPress Core

Opened 13 years ago

Closed 9 years ago

#20571 closed defect (bug) (worksforme)

problems with slug and view in custom post types

Reported by: thomask's profile thomask Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.3.1
Component: Posts, Post Types Keywords: has-patch close
Focuses: Cc:

Description

when creating custom post type, there are 2 minor problems

  1. when setting rewrite to false, it is not possible to edit slug (edit button missing) - this is wrong as slug is needed e.g. for get_post queries by name
  2. if the post is set not publicly_queryable, then anyway the post edit screen shows "View [custom post name]" and "Preview" button, which then points to 404 screen.

Attachments (1)

20571.diff (714 bytes) - added by jarednova 11 years ago.
Fixes #20571 -- allows editing of slug when rewrite is off

Download all attachments as: .zip

Change History (9)

#2 @johnbillion
13 years ago

  • Cc johnbillion added

#3 @jarednova
11 years ago

I can confirm issue 1 reported by @thomask. To clarify his steps:

1) Register a new post type (I used the books example from http://codex.wordpress.org/Function_Reference/register_post_type)
2) Create a new book ("Jurrassic Pak") and save, the permalink will be: http://localhost/?book=jurrassic-pak
3) Whoops! You realize there's a typo in your title, so you correct it to "Jurassic Park" -- but the typo is still in the slug, there's no way to update the posts's slug!


However on Issue 2 (publicly queryable), this IS documented in the codex as a gotcha ("Note: If you set this to FALSE, you will find that you cannot preview/see your custom post (return 404).") and seems to be a hotly debated topic in other tickets: (#17609) and (#20098).

I'm going to attempt issue #1, I'd recommend pursuing issue #2 as a separate ticket or via one of the related ones (#17609) and (#20098).

@jarednova
11 years ago

Fixes #20571 -- allows editing of slug when rewrite is off

#4 @jarednova
11 years ago

The attached diff fixes the issue reported by @thomask; I've tested and verified my diff in the following scenarios:

  • When the cpt has rewrite = true
  • When the cpt has rewrite = false
  • When the cpt has capability_type = post
  • When the cpt has capability_type = page

I'm unable to see any diff when using postname vs. pagename as the replacement var; I went with postname b/c it seemed more universal

#5 @jarednova
11 years ago

  • Cc jarednova added
  • Keywords has-patch added; needs-patch removed

#6 @johnbillion
11 years ago

#26956 was marked as a duplicate.

#7 @tyxla
9 years ago

  • Keywords close added

My 2 cents:

Issue 1:

Actually I disagree here. Even when rewrite is false, you are able to change the slug. If you go to Screen Options, you can tick the "Slug" box, which will allow you to edit the slug. The slug box was suggested to be removed in that case (see #18523), but as I stated there, I oppose to that, as anyone might need to edit the slug even for non-publicly-queryable posts.

Issue 2:

This is tracked separately in this ticket: #17609

So, it appears there is nothing else to be done here - I mark this ticket for closure.

#8 @wonderboymusic
9 years ago

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

Screen option exists + [17609]

Note: See TracTickets for help on using tickets.