Avoid get_the_guid() in fifu_get_full_image_url()
-
Hi – thanks for this plugin super useful.
The get_the_guid() docs say: “The guid will appear to be a link, but should not be used as an link to the post. The reason you should not use it as a link, is because of moving the blog across domains.“
Well.. I migrated sites and this has happened to me and that function now outputs urls of my product images (for which i have attachments) of example.com/?attachment_id=x – rather than example.com/wp-content/uploads/2024/01/x.jpg.
I solved this by replacing $url = $att_id ? get_the_guid($att_id) : null; in fifu_get_full_image_url() with $url = $att_id ? wp_get_attachment_image_src($att_id, 'full')[0] : null;. It seems to work for me, but would appreciate your perspective on this situation? Especially as my fix will be overwritten by the next update.
This product by the way doesn’t have any fifu images / postmetas, so i’m surprised I’m even making this fix. But this question is more about the first issue.
Thank you!
- The topic ‘Avoid get_the_guid() in fifu_get_full_image_url()’ is closed to new replies.