[wp-trac] Re: [WordPress Trac] #6698: Closing comments on old posts
causes trackbacks
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 11 05:12:59 GMT 2008
#6698: Closing comments on old posts causes trackbacks
--------------------------------------+-------------------------------------
Reporter: lapcat | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.8
Component: Administration | Version: 2.3.2
Severity: normal | Resolution:
Keywords: 2nd-opinion dev-feedback |
--------------------------------------+-------------------------------------
Changes (by vladimir_kolesnikov):
* keywords: => 2nd-opinion dev-feedback
Comment:
Replying to [comment:1 jacobsantos]:
> This needs to be reproduced in order to find where the mistake is
located. Not going to be a fun process.
:-) I think it is easy. When we save the post, edit_post() invokes
wp_update_post() which finally calls wp_insert_post(). If wp_insert_post()
succeeds, it will fire 'publish_post' event (we are talking about
published posts which gets modified later).
publish_post event is handled by _publish_post_hook. If you take a look at
it, it does this:
{{{
if ( get_option('default_pingback_flag') )
$wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key'
=> '_pingme' ) );
$wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' =>
'_encloseme' ) );
wp_schedule_single_event(time(), 'do_pings');
}}}
So if default_pingback_flag is on, WP will schedule pings. It doesn't
matter what we do - turning comments off or changing post title - this
hook will be triggered.
The only workaround I see right now (maybe need to think more), is modify
wp_insert_post() from
{{{
if ( isset($to_ping) )
$to_ping = preg_replace('|\s+|', "\n", $to_ping);
else
$to_ping = '';
}}}
to
{{{
if ( isset($to_ping) && get_option('default_pingback_flag') )
$to_ping = preg_replace('|\s+|', "\n", $to_ping);
else
$to_ping = '';
}}}
What do you think?
--
Ticket URL: <http://trac.wordpress.org/ticket/6698#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list