Hello,
We apologize for the inconvenience you’re experiencing with the Open Graph og:site_name
tag not processing variables as expected. We understand the importance of having this feature work seamlessly across all meta tags.
It seems that you are using custom variables to populate meta information, and while these values are processed without issue in other meta tags, they are not working as expected in the og:site_name
tag.
We recommend checking the implementation of the custom variables and Advanced Custom Fields to ensure that they are correctly integrated with Rank Math. Additionally, please ensure that the og:site_name
tag is properly configured within the Rank Math SEO plugin.
If you continue to experience issues after verifying the implementation, please feel free to reach out to our support team for further assistance. You can contact them here.
Thank you for bringing this to our attention, and we appreciate your understanding as we work to resolve this matter for you.
Sources:
General Tab in Meta Box of Rank Math SEO Plugin
Open Graph Meta Tags » Rank Math
How to Fix the ‘og: image’ Property Should Be Explicitly Provided » Rank Math
Analyzing Your Site’s SEO with Rank Math’s SEO Analysis Tool
Hello,
Apologies for the inconvenience.
Could you please confirm if you have added the variables in one of these sections where Rank Math pulls the value?
https://rankmath.com/kb/open-graph-meta-tags/#og-sitename
Meanwhile, you may try to use this filter on your site to programmatically change the og:site_name
in your meta tags:
add_filter( "rank_math/opengraph/facebook/og_site_name", function( $content ) {
$content = '%company_name% %sep% %gbp_category% %target_marketing_area%';
return $content;
});
And here’s how you can add filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
Thank you for the suggestions. Unfortunately, the variables were placed in the necessary field correctly as shown in this screenshot (Local SEO > Website Name):
https://imgur.com/hZdh6xa
Also unfortunately, applying the php filter provided in the functions.php file results in the same behavior in that the variables are not processed. Shown in these screenshots:
https://imgur.com/heC2x4t
https://imgur.com/c3Qevsz
I am wondering if there is a bug discovered here with the RankMath coding, since as you can see in the rest of the meta and Open Graph meta tags, the variables are processing correctly. Only in the og:site_name are the variables not processed, even when overridden with an add_filter function.
Your continued assistance is appreciated, thank you.
Hello,
Please note that the site name should be the same on all the pages. It isn’t recommended to use variables to change it based on which page you are on. It can prevent Google from showing the site name in the SERPs. Our plugin doesn’t support variables in the WebSite name field because of that.
If you still want to do that, you will have to modify the following filter to get the correct values directly from the custom fields instead of using variables:
add_filter( "rank_math/opengraph/facebook/og_site_name", function( $content ) {
$content = get_field('company_name' get_queried_object_id()).' - '.get_field('gbp_category' get_queried_object_id()).' - '.get_field('target_marketing_area' get_queried_object_id());
return $content;
});
Please make sure to use the correct field names in the filter.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Appreciate the explanation. Resolved.
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.