OpenGraph image url from category pages for functions.php
-
Hi
I have a custom social share button on category pages.
I implement it using functions.php but don’t know how to get og:image URL from category page. I need to get it for “media” of Pinterest share button URL:
1) category image URL if it is manually added in?Social Media Preview Snippet for Facebook
2) or if there is no such image, then use the global image URL from?Global Meta / OpenGraph Thumbnail
<a href="https://pinterest.com/pin/create/button/?url=<?php echo $category_url; ?>&media=<?php echo $og_image_encoded; ?>&description=<?php echo $category_title_encoded; ?>"As, far as I understand I need to deal with rank_math/opengraph/facebook/og_image_secure_url or rank_math/opengraph/facebook/og_image but how to get it from category pages and what function to use I don’t understand.
Thanks for help in advance!
- You must be logged in to reply to this topic.