custom terms

  • Hello,
    I’m trying to pass from Yoast to RankMath
    For product title this is the default structure

    %customterm(brand)% %wc_sku% %sep% %title% %sep% %customterm(product_cat)% %sep% %sitename%

    Obviously %customterm(brand)% and %customterm(product_cat)% are not recognize by RankMath.
    How can I automatize this to have for this 2 term the brand title (taxonomy from the theme) and product cat title (always taxonomy) in the product title SEO
    Thansk

    Ricky

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,
    here’s some updates

    In the front-end the title is correct – %customterm(brand)% – recognize the brand and %customterm(product_cat)% – recognize the category title

    The problem persist in the back-end where in snippet title is like this:
    Custom term value test-sku | Test title | Custom term value |

    How can be fix this?

    Also I have a few questions:
    – is it possible to add a custom term with custom value?
    – how can I add priceValidUntil, aggregateRating, review, EAN/Gtin? I already have this data in custom fields.

    Thanks
    Ricky

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I am not really sure if I fully understand your problem, is it that you have the right title in the frontend but the preview doesn’t show the right data?

    About your other questions:

    – Yes, you can a custom term, with this code:

    /**
     * Action: 'rank_math/vars/register_extra_replacements' - Allows adding extra variables.
     */add_action( 'rank_math/vars/register_extra_replacements', function(){
     rank_math_register_var_replacement(
     'custom_variable_slug',
     [
     'name'        => esc_html__( 'Custom variable name.', 'rank-math' ),
     'description' => esc_html__( 'Custom variable description.', 'rank-math' ),
     'variable'    => 'custom_variable_slug',
     'example'     => 'custom_variable_callback()',
     ],
     'custom_variable_callback()'
     );
    });

    – You should create a custom PHP code to get the values from those custom fields and add them to the Rank Math’s Rich Snippet Data, for example, for the Brand field you do this:

    // Add Brand for Products.
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    $entity['brand'] = 'Rank Math;
    return $entity;
    });

    Looking forward to helping you. Thank you.

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

You must be logged in to reply to this ticket.