You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We have a various clients that make use of the Global Media Library plugin for WordPress, which allows a multi-site instance to use a singular site as a hub for all media assets across multiple sites in a network.
The conflict between Rank Math & MGM happens when rank math tries to generate an OG Image tag. When you select an image stored in the Global media library, the image id is saved to the post in a slightly different format, so that MGM can identify between images stored on the current site or those saved to the hub site. The format saved is in the following format:
If we for example set a featured image stored in the hub site on a post, the id reference saved in the post_thumbnail field might be:
12300000012
123 = The Hub site id
12 = The attachment id saved in the network
When rank math tried to generate the OG Image tag the first function it runs into is:
wp_attachment_is_image
This will fail because the id format is non-standard, and technically an attachment with this id doesn't actually exist. And unfortunately this is an function without filters or actions.
Describe the solution you'd like
My proposed solution is to add a do_action before the wp_attachment_is_image check, as well as a filter for the attachment id. This will allow me to add a site switch inside of the do_action (in my theme or plugin) then add a another do_action after the get_variations function call to switch the site back to the current site.
I've attached a screenshot with the proposed changes below. New code is labelled with a "new code" comment. The filter and action names are purely placeholder names to demonstrate the code changes I would like to see.
Describe alternatives you've considered
As we can not filter the code before the image check there is no alternative to get OG image tags generated in Rank Math SEO currently.
The text was updated successfully, but these errors were encountered:
codedbyglenden
changed the title
Rank Math Compatibility with the multisite-global-media plugin
[Feature] Rank Math Compatibility with the multisite-global-media plugin
Jun 12, 2024
Thank you for submitting a PR. I checked this on my local setup and was able to reproduce the issue. I believe hooks are needed to switch and reset the blogs. If so, shouldn't we pass $attachment_id to the hook? I have also added a comment in the PR: https://github.com/rankmath/seo-by-rank-math/pull/283/files#r1642583643
Is your feature request related to a problem? Please describe.
We have a various clients that make use of the Global Media Library plugin for WordPress, which allows a multi-site instance to use a singular site as a hub for all media assets across multiple sites in a network.
Plugin link: multisite-global-media
The conflict between Rank Math & MGM happens when rank math tries to generate an OG Image tag. When you select an image stored in the Global media library, the image id is saved to the post in a slightly different format, so that MGM can identify between images stored on the current site or those saved to the hub site. The format saved is in the following format:
{hub_site_id}000000{actual_attachment_id_saved_on_the_hub_site}
If we for example set a featured image stored in the hub site on a post, the id reference saved in the post_thumbnail field might be:
12300000012
123 = The Hub site id
12 = The attachment id saved in the network
When rank math tried to generate the OG Image tag the first function it runs into is:
wp_attachment_is_image
This will fail because the id format is non-standard, and technically an attachment with this id doesn't actually exist. And unfortunately this is an function without filters or actions.
Describe the solution you'd like
My proposed solution is to add a do_action before the wp_attachment_is_image check, as well as a filter for the attachment id. This will allow me to add a site switch inside of the do_action (in my theme or plugin) then add a another do_action after the get_variations function call to switch the site back to the current site.
I've attached a screenshot with the proposed changes below. New code is labelled with a "new code" comment. The filter and action names are purely placeholder names to demonstrate the code changes I would like to see.
Describe alternatives you've considered
As we can not filter the code before the image check there is no alternative to get OG image tags generated in Rank Math SEO currently.
The text was updated successfully, but these errors were encountered: