Change Rank Math OG tags

#14905
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

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

    You can replace the code we gave you last time with the following:

    /**
     * Change Rank Math OG 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/og_locale", function( $content ) {
    	//replace /custompagename/ with the path to the page you want to 
    	//modify the tags
    	if(strpos($_SERVER['REQUEST_URI'],'de')>0){
    	     //replace en_UK with your preferred locale
    	     $content = "en_UK";
    	     return $content;
    	}
    	return $content;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Just changed code to above and has not worked. Now not working on parent page either 🙁

    Hello,

    Thanks for getting back to us.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Updated with login.

    If you can let me know the tweaks needed as we have the same problem on another site

    Hello,

    Thanks for getting back to us.

    I can see that the previous code is working correctly and it is changing the locale to ‘en_UK’ as shown below:
    [DELETED IMAGE]

    Please let me know if I am missing something. Thank you.

    • This reply was modified 4 years, 7 months ago by Michael Davis.

    It was supposed to be content=’de’ in the /de/ sub folder…I have just updated code and seems to be working OK.

    What did you do to make it work for all pages in the /de/ directory? I need to do the same on another website.

    Please also remove image from last rely (if public) as my site is exposed.

    Hi Jane,

    Thanks for the response.

    I am glad that this is now working as expected.
    Please note that I did not make any changes to the code I shared before, I think you only needed to pass the right locale on this line:
    $content = "en_UK";

    Feel free to contact us for any other questions, comments or suggestions. Thank you.

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

You must be logged in to reply to this ticket.