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
2769            * Fires immediately before an object-term relationship is added.
2770            *
2771            * @since 2.9.0
2772            * @since 4.7.0 Added the `$taxonomy` parameter.
2773            *
2774            * @param int    $object_id Object ID.
2775            * @param int    $tt_id     Term taxonomy ID.
2776            * @param string $taxonomy  Taxonomy slug.
2777            */
2778           do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy );
2779
2780           $wpdb->insert(
2781                $wpdb->term_relationships,
2782                array(
2783                     'object_id'        => $object_id,
2784                     'term_taxonomy_id' => $tt_id,
2785                )
2786           );
2787