Primary category in Schema

#640810
Viewing 5 replies - 1 through 5 (of 5 total)
  • Anonymous
    Rank Math free

    sorry, it is “Parent category” not “Primary category”

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    If you have chosen the “Product Categories” option in the Select Brand option, the primary category will be selected as your brand in your product schema.

    However, if you want to change the brand to be your product category instead, you can use and customize this filter on your site:

    /**
    * Filter to add Brand Name for Products.
    *
    * @param array $entity Snippet Data
    * @return array
    */
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    $entity['brand']['@type'] = 'Brand';
    $entity['brand']['name'] = 'Rank Math';
    return $entity;
    });

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Hope that helps.

    Thank you.

    Anonymous
    Rank Math free

    Hi Reinelle,
    Thank you for your helping.
    How about meta property=”product:brand” content?

    Anonymous
    Rank Math free

    and i found that can not display in Chinese character.
    if i type in Chinese character will be shown “\u52b3\u529b\u58eb” like this.
    thank you

    Hello,

    Thank you for your patience.

    For the meta tag product:brand, you can add this filter:

    /**
     * Allow developers to change the content of specific social meta tags.
     *
     * The dynamic part of the hook name. $network, is the network slug
     * and $og_property, is the property which we are outputting.
     *
     * @param string $content The content of the property.
     */
    add_filter( "rank_math/opengraph/facebook/product_brand", function( $content ) {
    	$content = 'My Brand'; //change to the actual brand
    	return $content;
    });

    Regarding the Chinese characters, you are seeing the UTF-8 encoding that is required for the browsers to understand the URLs and pass them to the server to make requests, and there is no issue with that.

    Hope that helps.

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Primary category in Schema’ is closed to new replies.