Support » Plugin: The SEO Framework » social image is svg

  • Resolved cjyabraham


    Since we use a lot of SVGs on our site sometimes they get used as the social image url even though twitter can’t use an SVG for its social image. Is it possible to ensure that SVGs are not used for this purpose?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sybre Waaijer



    Thank you for raising this issue. I’m afraid we didn’t consider this case because SVGs are typically blocked in WordPress.

    I’m going to work out a method so to strip unacceptable files for social sharing. I can’t promise a solution will be available in the next update, however. This is particularly a difficult issue (performance-wise) because image URLs don’t necessarily need to have a file extension.

    In the meantime, this (pretty complex) filter will do the trick–provided the linked files have the .svg extension:

    What it does is override the default image-from-content generator function with a carbon-copy (line 8). In the generator, I added an SVG check before forwarding any image found (line 45).

    If you prefer not to use that filter, then I recommend setting an image via the provided social image fields for the affected pages. That should have the highest priority for social sharing.

    Thanks for the help. I’ve combined that custom code with other code you gave me for finding the parent social url if there isn’t one set for the current page. It seems to be working for me.

    Plugin Author Sybre Waaijer


    No problem! I’m glad it works well for you!

    I recommend placing it before the 'social' !== $context check, however–since you may also want to strip SVGs from other callers to the generator (i.e., the Articles extension). But if you don’t use that extension, then I see no issue with the current implementation 🙂

    Have a wonderful day!

    Good point. Done. Thanks again for your help. I’m not so accustomed to using generators etc. but they seem pretty cool.

    Plugin Author Sybre Waaijer


    Howdy 🙂

    I just fixed the issue via this commit. It’ll be shipped with TSF v4.0.5. When you update the plugin, you can remove the custom tweak. Cheers!



    Thanks for the update. I’ll look out for the release.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.