featured image caption breaks website with new update
-
I updated my wordpress to version 4.6 and my website completely broke. I would get just a blank white screen if I tried to visit anywhere on my website, including the admin panel.
After days of debugging I narrowed it down to a function I added into my themes fuction.php file. It’s a code that is supposed to get the caption of the posts featured image and display it where I choose.
function the_post_thumbnail_caption() { global $post; $thumbnail_id = get_post_thumbnail_id($post->ID); $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment')); if ($thumbnail_image && isset($thumbnail_image[0])) { echo '<span>'.$thumbnail_image[0]->post_excerpt.'</span>'; } }
It was working fine before, but now the code above seems to not work. Does anybody know the issue?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘featured image caption breaks website with new update’ is closed to new replies.