Rework wp_publish_post(). Should avoid running filters when changing from future to publish.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f423760531
commit
15b1452d54
|
@ -652,22 +652,7 @@ function wp_insert_post($postarr = array()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($post_status == 'publish' && $post_type == 'post') {
|
if ($post_status == 'publish' && $post_type == 'post') {
|
||||||
do_action('publish_post', $post_ID);
|
wp_publish_post($post_ID);
|
||||||
|
|
||||||
if ( !defined('WP_IMPORTING') ) {
|
|
||||||
if ( $post_pingback )
|
|
||||||
$result = $wpdb->query("
|
|
||||||
INSERT INTO $wpdb->postmeta
|
|
||||||
(post_id,meta_key,meta_value)
|
|
||||||
VALUES ('$post_ID','_pingme','1')
|
|
||||||
");
|
|
||||||
$result = $wpdb->query("
|
|
||||||
INSERT INTO $wpdb->postmeta
|
|
||||||
(post_id,meta_key,meta_value)
|
|
||||||
VALUES ('$post_ID','_encloseme','1')
|
|
||||||
");
|
|
||||||
wp_schedule_single_event(time(), 'do_pings');
|
|
||||||
}
|
|
||||||
} else if ($post_type == 'page') {
|
} else if ($post_type == 'page') {
|
||||||
wp_cache_delete('all_page_ids', 'pages');
|
wp_cache_delete('all_page_ids', 'pages');
|
||||||
$wp_rewrite->flush_rules();
|
$wp_rewrite->flush_rules();
|
||||||
|
@ -736,10 +721,29 @@ function wp_publish_post($post_id) {
|
||||||
if ( empty($post) )
|
if ( empty($post) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( 'publish' == $post->post_status )
|
if ( 'publish' != $post->post_status )
|
||||||
|
$wpdb->query("UPDATE IGNORE $wpdb->posts SET post_status = 'publish' WHERE ID = $post_id");
|
||||||
|
|
||||||
|
do_action('publish_post', $post_id);
|
||||||
|
|
||||||
|
if ( defined('WP_IMPORTING') )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));
|
$post_pingback = get_option('default_pingback_flag');
|
||||||
|
if ( $post_pingback )
|
||||||
|
$result = $wpdb->query("
|
||||||
|
INSERT INTO $wpdb->postmeta
|
||||||
|
(post_id,meta_key,meta_value)
|
||||||
|
VALUES ('$post_ID','_pingme','1')
|
||||||
|
");
|
||||||
|
|
||||||
|
$result = $wpdb->query("
|
||||||
|
INSERT INTO $wpdb->postmeta
|
||||||
|
(post_id,meta_key,meta_value)
|
||||||
|
VALUES ('$post_ID','_encloseme','1')
|
||||||
|
");
|
||||||
|
|
||||||
|
wp_schedule_single_event(time(), 'do_pings');
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||||
|
|
Loading…
Reference in New Issue