Opened 13 years ago
Closed 13 years ago
#22353 closed enhancement (invalid)
in function wp_publish_post, make it call the wp_update_post
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | trivial | Version: | 3.5 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
If the post is submitted by role who cannot publish posts, the post will be pending by default and the post name will be empty.
We have a custom posts management interface to approve pending posts.
We use wp_publish_post to approve posts.
Sadly, we find out the approved posts don't have post slug.
So I just wonder will it be better if it can call wp_update_post to handle post status update.
Just my 2 cents.
Thanks for your hard work on wordpress!
function wp_publish_post($post_id) {
global $wpdb;
$post = get_post($post_id);
if ( empty($post) )
return;
if ( 'publish' == $post->post_status )
return;
$old_status = $post->post_status;
$post->post_status = 'publish';
wp_update_post($post);
wp_transition_post_status('publish', $old_status, $post);
do_action('edit_post', $post_id, $post);
do_action('save_post', $post_id, $post);
do_action('wp_insert_post', $post_id, $post);
}
Change History (1)
Note: See
TracTickets for help on using
tickets.
This is already the case since [22189] (WP 3.5-beta2).