WP – Notice Error (thumbnail)
-
Heya, been using this plugin and doing final debug of the project and found that on many pages that show wp-postratings (but not all) there is a PHP notice.
Notice: Undefined variable: thumbnail in C:\wamp64\www\reefrepair\website\wp-content\plugins\wp-postratings\wp-postratings.php on line 1176
Output code below for reference.
if(function_exists(‘the_ratings’)) :
echo ‘<div class=”outlined”>Was This Page Helpful?</div>’;
the_ratings();
endif;– Please check, thank you ??
—————————
Looking at your code, I feel like you should be setting $thumbnail to null or empty before trying to use it as a function index on line 1176, as it can be non existant.
// You should declare a $thumbnail variable before line 1172
$thumbnail = ”;—-
// Post Thumbnail
if( has_post_thumbnail() ) {
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( null ) );
}
$thumbnail = apply_filters( ‘wp_postratings_post_thumbnail’, $thumbnail, $post_id );
- The topic ‘WP – Notice Error (thumbnail)’ is closed to new replies.