Ticket #4844 (closed enhancement: fixed)

Opened 10 months ago

Last modified 6 months ago

Need set_post_type API

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

Description

Currently there is a get_post_type function, which with other functions allows plugins to use custom "post_type"s. There should be API to set the post_type without having to access the db directly.

Attachments

set_post_type.diff (0.6 kB) - added by filosofo on 08/28/07 19:26:52.
set_post_type.2.diff (0.6 kB) - added by filosofo on 09/16/07 22:52:04.

Change History

08/28/07 19:26:52 changed by filosofo

  • attachment set_post_type.diff added.

09/16/07 22:52:04 changed by filosofo

  • attachment set_post_type.2.diff added.

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

The second patch sanitizes post_type per rboren's suggestion at comment:ticket:4991:1

(follow-up: ↓ 3 ) 10/10/07 18:08:00 changed by ryan

I think this needs to use wp_update_post() so that all of the right actions are triggered.

(in reply to: ↑ 2 ) 10/10/07 19:46:03 changed by filosofo

Replying to ryan:

I think this needs to use wp_update_post() so that all of the right actions are triggered.

One advantage to a stand-alone function instead of just using wp_update_post() is that you don't have to know all of the post data first.

Also, other aspects of a post can be changed without going through wp_update_post, such as categories, tags, ping URLs, and post meta-data.

And you keep the API parallel: where there's a get_* there should be a set_* or update_*

01/02/08 20:06:00 changed by ryan

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

(In [6537]) set_post_type from filosofo. fixes #4844

01/02/08 20:06:34 changed by ryan

I added db prepare and some phpdoc, hopefully didn't break anything.