Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: add_term_relationship

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
2783            * Fires immediately before an object-term relationship is added.
2784            *
2785            * @since 2.9.0
2786            * @since 4.7.0 Added the `$taxonomy` parameter.
2787            *
2788            * @param int    $object_id Object ID.
2789            * @param int    $tt_id     Term taxonomy ID.
2790            * @param string $taxonomy  Taxonomy slug.
2791            */
2792           do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy );
2793
2794           $wpdb->insert(
2795                $wpdb->term_relationships,
2796                array(
2797                     'object_id'        => $object_id,
2798                     'term_taxonomy_id' => $tt_id,
2799                )
2800           );
2801