post_link_category

post_link_category

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('post_link_category') is found 1 times:

  • /wp-includes/link-template.php line 244
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    * @param WP_Term  $cat  The category to use in the permalink.
     * @param array    $cats Array of all categories (WP_Term objects) associated with the post.
     * @param WP_Post  $post The post in question.
     */
    $category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post );
     
    $category_object = get_term( $category_object, 'category' );
    $category        = $category_object->slug;
    if ( $category_object->parent ) {
        $category = get_category_parents( $category_object->parent, false, '/', true ) . $category;
    }

See this hook used in plugins: