Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#22353 closed enhancement (invalid)

in function wp_publish_post, make it call the wp_update_post

Reported by: wordpressplugindeveloper Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.5
Component: General Keywords:
Focuses: Cc:


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) )

	if ( 'publish' == $post->post_status )

	$old_status = $post->post_status;
	$post->post_status = 'publish';

	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)

#1 @scribu
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Type changed from feature request to enhancement

This is already the case since [22189] (WP 3.5-beta2).

Note: See TracTickets for help on using tickets.