PHP Warning when showing social share buttons if no post thumbnail
-
Hi,
While reading my logs, I’ve seen a lot of warnings coming from the theme:
PHP Warning: Trying to access array offset on value of type bool in /data/wp-content/themes/square/inc/template-tags.php on line 138"
When generating the pinterest URL for the social share buttons in inc/template-tags.php, it tries to access the post_thumbnail array created from wp_get_attachment_image_src(). However that function returns false if there is no image available, so it generates an warning when trying to access the array at index 0.
For now, I’ve fixed it by changing the offending file, but is it possible to have it fixed here so I don’t need to add that change back every update ?
Thanks for making this cool theme.
- You must be logged in to reply to this topic.