Get primary term

#814751
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    To get only the object of the primary term in Rank Math, you can use the following filter:

    /**
     * Filter to change the primary term output of the breadcrumbs class.
     *
     * @param WP_Term $term  Primary term.
     * @param array   $terms Terms attached to the current post.
     */
    add_filter( 'rank_math/frontend/breadcrumb/main_term', function( $current_term, $terms ) {
        return $current_term;
    }, 10, 2 );

    This filter allows you to change the primary term output dynamically on the front-end. By using this filter, you can manipulate and retrieve only the object of the primary term.

    If you need further assistance or have any more questions, feel free to ask.

    Thank you for reaching out.

    Sources:
    Rank Math SEO Filters and Hooks for Developers – Rank Math
    General Tab in Meta Box of Rank Math SEO Plugin
    Rank Math ‘Titles and Meta’ Options and Settings
    Score 100/100 With Rank Math Post Tests » Rank Math

    Hello,

    Thank you so much for getting in touch.

    Our plugin doesn’t store the primary category by object. We store them in this specific meta name rank_math_primary_category with a value of the term Id.

    Hope that helps.

    Just so people know, it may be that the meta name is ‘rank_math_primary_categories’

    Hello @nicole-herring,

    We appreciate your input but we store the primary category data in the meta field name rank_math_primary_category in your database:

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘Get primary term’ is closed to new replies.