Permalink structure by Post Meta value

I changed this line:

$wp_rewrite->add_rewrite_tag( '%selected_meta%', '([^&]+)', '?meta=" );

Into:

$wp_rewrite->add_rewrite_tag( "%selected_meta%', '([^&]+)', 'post_type=ervaring&meta=" );

Wich was for both issue 1 and 2 enough to work with.

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