themes – How to get rid of undefined variable in previous post image


I am working on a website on WordPress and I have it set to where the bottom of the post will automatically link to a random previous post with a picture from that previous link but a notice keeps popping up on the bottom. It says there is something wrong with the previous post image url but the website sets this automatically and it works for all my other posts. Since it is undefined should I try to define it in the code and include the url and image url? There is an if statement beforehand that makes this code run if there is a previous post image url and this is using the Mia theme on WordPress

 previous_post_link( '%link', '<div class="post-navigation-image"><img src="' . $previous_post_image_url . '" /></div><div class="post-navigation-content"><div class="post-navigation-title"><span class="next-post">Next Post &gt;</span><h3>%title</h3></div></div>' );
    echo '</div>';

Eric 8 months 2022-05-24T19:56:24-05:00 0 Answers 0 views 0

Leave an answer