Use different variables to fill in meta title and description depending on the l

#53535
  • Resolved Javier Windup
    Rank Math free

    Hello, everybody.

    In my web I am using WPML to translate the content to English and Spanish and I want the metatitle and metadescription of certain pages to have fixed parts and variable parts.

    Here’s an example

    EN: Apartments in %category% for sale
    ES: Apartamentos en %category% al a venta

    Is it possible to have a different configuration in this sense for each language with Rank Math?

    Thank you very much.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    Yes this is available in the plugin. You can either use WPML to translate your meta titles and descriptions on the string translation page or you could come up with some custom code to translate the tags by using the ICL_LANGUAGE_CODE constant to check the current language.

    You can use these filters:

    /**
     * Filter to change the page title.
     * 
     * @param string $title
     */
    add_filter( 'rank_math/frontend/title', function( $title ) {
    	return $title;
    });
    /**
     * Allow changing the meta description sentence from within the theme.
     *
     * @param string $description The description sentence.
     */
    add_filter( 'rank_math/frontend/description', function( $description ) {
    	return $description;
    });

    Looking forward to helping you. 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 1 replies (of 1 total)

The ticket ‘Use different variables to fill in meta title and description depending on the l’ is closed to new replies.