$wpdb->get_results breaking page?

For me the problem would be to use a plugin that uses evil() eval() to evaluate string as PHP, in the first place šŸ˜‰

This part is from the PHP manual:

Caution The eval() language construct is very dangerous because it
allows execution of arbitrary PHP code. Its use thus is discouraged.
If you have carefully verified that there is no other option than to
use this construct, pay special attention not to pass any user
provided data into it without properly validating it beforehand.

Most likely the global $wpdb is missing, but I would suggest to you to just create your own shortcode instead.


add_shortcode( 'tim_daniels_list', function( $atts = [], $content="" )
    global $wpdb;
    $years = $wpdb->get_results( 
        "SELECT YEAR(post_date) AS year 
         FROM {$wpdb->posts} 
         WHERE post_type="results" AND post_status="publish" 
         GROUP BY year DESC" 
    foreach ( (array) $years as $year ) {
        $html .= '<h2>' . $year->year . '</h2>';
    return $html;