Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#4991 closed defect (bug) (fixed)

Edit post post_type should actually be the post_type

Reported by: filosofo's profile filosofo Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.3
Component: General Keywords: post_type edit has-patch
Focuses: Cc:

Description

Lately for a couple of plugins I've created a custom post_type.

However, when editing a post, the post_type input field has hard-coded "post" as its value, meaning post_type is always overwritten as "post."

My patch sets the post_type field with whatever the post type actually is.

Attachments (4)

edit_form_adv_post_type.diff (851 bytes) - added by filosofo 17 years ago.
sanitize_post_type.diff (411 bytes) - added by filosofo 17 years ago.
post_type.diff (1.3 KB) - added by ryan 16 years ago.
5740.diff (2.1 KB) - added by DD32 16 years ago.
patch from #5740

Download all attachments as: .zip

Change History (12)

#1 @ryan
17 years ago

Some sanitization is probably in order if we allow arbitrary types. Perhaps add sanitize_title to the pre_post_type filter?

#2 @filosofo
17 years ago

I added a patch to sanitize post_type. Please also see also #4844

@ryan
16 years ago

#3 @ryan
16 years ago

Since we've already fetched the post, we can use what's already there. See post_type.diff.

#4 follow-up: @lloydbudd
16 years ago

Duplicated in #5740.

#5 @ryan
16 years ago

For the post_type sanitizer, we should use a less expensive function than sanitize_title() which does UTF-8 octet encoding and accent removal. Something more like sanitize_user() strict.

#6 in reply to: ↑ 4 @DD32
16 years ago

Replying to lloydbudd:

Duplicated in #5740.

Whoops :)

I'll put my patch up here from that ticket anyway.

@DD32
16 years ago

patch from #5740

#7 @ryan
16 years ago

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

(In [6712]) Don't hard code post type in edit forms. Props filosofo and DD32. fixes #4991

#8 @ryan
16 years ago

Changed it up a little to user get_default_post_to_edit() and get_default_page_to_edit() to set the default post_type and post_status.

Note: See TracTickets for help on using tickets.