Ticket #4991 (closed defect: fixed)

Opened 1 year ago

Last modified 8 months ago

Edit post post_type should actually be the post_type

Reported by: filosofo Assigned to: anonymous
Priority: normal Milestone: 2.5
Component: General Version: 2.3
Severity: normal Keywords: post_type edit has-patch
Cc: filosofo

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

edit_form_adv_post_type.diff (0.8 kB) - added by filosofo on 09/16/07 21:51:15.
sanitize_post_type.diff (411 bytes) - added by filosofo on 09/16/07 22:51:43.
post_type.diff (1.3 kB) - added by ryan on 10/10/07 18:01:29.
5740.diff (2.1 kB) - added by DD32 on 01/31/08 22:51:15.
patch from #5740

Change History

09/16/07 21:51:15 changed by filosofo

  • attachment edit_form_adv_post_type.diff added.

09/16/07 22:14:15 changed by ryan

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

09/16/07 22:51:43 changed by filosofo

  • attachment sanitize_post_type.diff added.

09/16/07 22:58:00 changed by filosofo

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

10/10/07 18:01:29 changed by ryan

  • attachment post_type.diff added.

10/10/07 18:02:15 changed by ryan

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

(follow-up: ↓ 6 ) 01/31/08 15:37:53 changed by lloydbudd

Duplicated in #5740.

01/31/08 18:23:05 changed by ryan

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.

(in reply to: ↑ 4 ) 01/31/08 22:50:37 changed by DD32

Replying to lloydbudd:

Duplicated in #5740.

Whoops :)

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

01/31/08 22:51:15 changed by DD32

  • attachment 5740.diff added.

patch from #5740

02/02/08 19:22:15 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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

02/02/08 19:22:46 changed by ryan

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.