SQL error with custom query

Should be:

$where .= " AND voted > 1";

Other notes:

  • instead of hardcoding table names you should use $wpdb->prefix . 'post_votes';

  • instead of checking in global $_GET you should declare your filters as accepting two arguments and code functions accordingly, these filters pass as second argument object that contains all of query data.

Like:

add_filter('posts_where', 'vote_where', 10, 2 );

function vote_where( $where, $query ) {

    if( isset( $query->query_vars['vp_sort'] ) );
        $where .= ' AND voted > 1';

    return $where;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)