Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: set_object_terms

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2238                if ( in_array($tt_id, $final_tt_ids) )
2239                     $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
2240           if ( $values )
2241                if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) )
2242                     return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
2243      }
2244
2245      wp_cache_delete( $object_id, $taxonomy . '_relationships' );
2246
2247      do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);
2248      return $tt_ids;
2249 }
2250
2251 /**
2252  * Add term(s) associated with a given object.
2253  *
2254  * @package WordPress
2255  * @subpackage Taxonomy
2256  * @since 3.6