disabeling Rank Math displays shared featured images on Facebook again

#347621
  • Resolved Regio Online
    Rank Math free

    Hi,

    Just closed a topic about this, but one question still not answered

    Hi, sorry, a question another question pupped up about this.

    Miguel wrote:

    We use the default WordPress function wp_check_filetype() to check the type of image that can be added to the OpenGraph meta tags based on their guidelines.

    But with Rank Math disabled the images are posted on Facebook and Twitter again, even if the link is without a filetype() from Google Drive!!

    Question:
    Can we disable the wp_check_filetype() in Rank Math somehow?

    Thanks

Viewing 15 replies - 1 through 15 (of 21 total)
  • Hello,

    Thank you for contacting Rank Math today.

    That is possible to disable the function that checks if the file extension is allowed but that could cause different issues as it will allow not supported image types to pass through.

    In case you still want to try this you can disable the check for the valid image type on line 214 to 216 of the file wp-content\plugins\seo-by-rank-math\includes\opengraph\class-image.php​​​​​​

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Regio Online
    Rank Math free

    Thanks Miguel,

    I will try this. Thanks so much (again)!

    Hello,

    If you need assistance with this just let us know and we’ll gladly provide further insights or help with this matter.

    Looking forward to helping you.

    Regio Online
    Rank Math free

    Hi,

    I have tried your solution, but it seems not to work. The first try I got the right image from Google Drive when pasting the sharelink in Facebook, but the image itself didn ‘t show up on Facebookpage itsef. After that a random image was selected from the 16 logo’s we have put in WP Media Library (in WP itself). Not showing the selected placeholder we have placed in Rank Math.

    We use only jpg and png images, so there should be no problem with the validity of the images when commenting out lines 214-216

    Could there be some resolution in the ‘Allow changing the OpenGraph image.’ code from rule 219 down somewhere maybe?

    Thanks again.

    Hello,

    We don’t know the specifics of the plugin you are using for this but could you please let us know how the information from the image of each post/page is saved through that plugin? Maybe they use an entry inside the postmeta table?

    We ask this because knowing more about that would maybe allow us to create a custom filter that you could add to the website to always try to fetch that image first.

    Looking forward to hearing back from you.

    Regio Online
    Rank Math free

    I will try to find out Miguel.

    Thanks for going above and beyond for us with this. Much appreciated!!

    For now I can give you the links to the pluging so you have an idea of what we use. The plugin is called WordPress Media Folders (https://www.joomunited.com/wordpress-products/wp-media-folder) We use the premium version with add-ons for Google Drive (https://www.joomunited.com/wordpress-products/wp-media-folder/google-drive-integration-with-the-wordpress-media-manager)

    Maybe this can give you some inside at forehand

    Regio Online
    Rank Math free

    Hi Miguel,

    Finding code and tables is quit difficult, but here is what I have done to test deffitnetly if this is a Rank Math issue or not (for us at least):

    1. Disabeled Rank Math plugin
    2. Cleared all the cache
    3. Posted two articles, both with featured image
    4. Both post where automaticly posted on Facebook with Jetpack (and Twitter and Tumblr)
    5. Example of 1 article with image and results on Facebook given below

    Article link on website: https://regioonline.nl/regio-zeeland/beweegroute-in-goes-maakt-dagelijks-bewegen-leuk-en-gemakkelijk/

    On Facebook: https://www.facebook.com/RegioOnline.NL

    Facebook link to image is: https://external-ams4-1.xx.fbcdn.net/safe_image.php?d=AQFwoIq0XB0N7MR6&w=500&h=261&url=https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1nwZ4HtGStbeFSfPTx8XvnE_FZCqvulUK&cfs=1&ext=jpg&_nc_oe=6f9be&_nc_sid=06c271&ccb=3-5&gt=1&_nc_hash=AQFhvfX0YHez9J1b

    As you can see Facebook finds the link on Google Drive, but also recognizes the file extension as jpg

    Questions:

    a. Why can’t Rank Math recognise the file extension?
    b. Is there any possibilty to fix this issue of have a workaround?

    You staed in my previous tickect that the wp_check_filetype() function was at fault of this. But WordPress and Jetpack have no trouble recognising file extension it seems. It is the only thing standing between a great SEO plugin and looking for alternatives.

    I know you are trying your best so please do not consider this a ‘I bite your head off’ 😉 but I am trying to keep Rank Math as our SEO plugin.

    Thanks in advance for your time and efforts all!

    Regards,

    Egbert

    Hello,

    The reason we don’t recognize the image is that the core WordPress function that we mentioned before is not able to get the correct extension from the image files.

    This doesn’t mean this is an issue with WordPress, but rather the fact that we use a core WordPress function in our checks for the images and that is failing. WordPress itself doesn’t use this function to see if it can add the images there or not.

    If you can find where this is saved in the database the following filter can be used to force the absolute URL to the correct tags: https://rankmath.com/kb/filters-hooks-api-developer/#change-opengraph-image

    Besides that, there’s nothing else we can do from our side as we want to keep using that check in our plugin before adding the images.

    Don’t hesitate to get in touch if you have any other questions.

    Regio Online
    Rank Math free

    Thanks so much Miguel. This is defenitly something I want to try.

    Do I need to aply this filter in wp-content\plugins\seo-by-rank-math\includes\opengraph\class-image.php?

    Many thanks again for goig the extra mile here for us Miguel!

    Hello,

    No, that filter needs to be modified as per your requirements and then added with one of the following options: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    There will need to be a check for the image from the plugin you are using and associate it with the current post, so the final filter will depend on the way that other plugin saves the data.

    Don’t hesitate to get in touch if you have any other questions.

    Regio Online
    Rank Math free

    Thanks for the right info! I will ask the other plugin builders where they save this data!

    Hello,

    Sure, do let us know how that goes.

    In the meantime, please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    Regio Online
    Rank Math free

    Hi Jeremy,

    I got my answer from the other plugin builders

    The plugin (WordPresss Media Folder – Google Add-on) saved the link in #_postmeta table.

    You can get it from meta_key is wpmf_drive_link.

    For example:

    $image_url = get_post_meta($attachment_id, ‘wpmf_drive_link’, true);

    Can you help me with this info to make a filter I can put in a rank-math.php file in my child theme?

    Thank you so much for all your efforts and time in advance!

    Regards!

    Hello,

    Please try inserting this filter into your functions.php file and see if this resolves the issue:

    add_filter( "rank_math/opengraph/facebook/image", function( $attachment_url ){
        global $post;
        $attachment_url = get_post_meta($post->ID, 'wpmf_drive_link', true);
        return $attachment_url;
    });

    Let us know how that goes. Looking forward to helping you on this one.

    Regio Online
    Rank Math free

    Hi,

    I tried your solution in the functions.php of my childtheme. After clicking publisize in WordPress I was not able to view my post. It gave a ‘critical WordPress error’ page. After I removed the filter, it functioned fine again. I tried your filter with and without your earlier suggestion of commenting out lines 214-216 in wp-content\plugins\seo-by-rank-math\includes\opengraph\class-image.php (disable the function that checks if the file extension is allowed).

    If you have any other suggestions, they are very welcome. Please let me know if this is to much work. I understand and will find a different solution.

    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 15 replies - 1 through 15 (of 21 total)

The ticket ‘disabeling Rank Math displays shared featured images on Facebook again’ is closed to new replies.