[wp-trac] [WordPress Trac] #16593: wp_set_object_terms not creating links when in a save_post action

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 20 09:09:26 UTC 2011


#16593: wp_set_object_terms not creating links when in a save_post action
-------------------------------+------------------------------
 Reporter:  grandslambert      |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  General            |     Version:  3.0.5
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------
Changes (by greuben):

 * keywords:   => reporter-feedback


Comment:

 I can’t reproduce the issue…I am using the code below to create tags and
 it works fine


 {{{
 add_action( 'save_post', 'my_test' );
 function my_test( $post_id ) {
         global $post;
         if( ! isset( $post->post_type ) || $post->post_type != 'post' )
                 return $post_id;

         wp_set_object_terms( $post_id, array( 'test1', 'test2' ),
 'post_tag' );
         return $post_id;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16593#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list