[wp-trac] [WordPress Trac] #10545: _publish_post_hook (adding to postmeta existing hooks)

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 4 21:24:05 UTC 2009


#10545: _publish_post_hook (adding to postmeta existing hooks)
--------------------------+-------------------------------------------------
 Reporter:  butuzov       |       Owner:                                    
     Type:  defect (bug)  |      Status:  new                               
 Priority:  normal        |   Milestone:  2.8.4                             
Component:  Optimization  |     Version:  2.8.1                             
 Severity:  normal        |    Keywords:  publish_post_hook, pings, postmeta
--------------------------+-------------------------------------------------
 The problem that each time yuo press publish (assuming this is a save
 button) wp add to postmeta table new records even thay already exist now.


 {{{
 if ( get_option('default_pingback_flag') )
                 $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key'
 => '_pingme' ) );
         $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' =>
 '_encloseme' ) );
 }}}

 shoud be (something like)


 {{{
 if ( get_option('default_pingback_flag') ){
                 get_post_meta($post_id, '_pingme') ?
 update_post_meta($post_id, '_pingme', 1) : add_post_meta($post_id,
 '_pingme', 1);

         get_post_meta($post_id, '_encloseme') ? update_post_meta($post_id,
 '_encloseme', 1) : add_post_meta($post_id, '_encloseme', 1);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10545>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list