Probly easy question but just cant seem to find whats wrong. I cant build a query based on a search when i use ' ' but not when i use a alrdy declared variable.
This works
$query2 = new WP_Query( 's='motorkap met' );
while( $query2->have_posts() ) {
$query2->the_post();
echo the_title();?> </br> <?php
}
This doesnt for some reason.... I cant seem to find how to pass the already declared variable
$zoekterm = removeCommonWords('motorkap met');
$query2 = new WP_Query( 's=$zoekterm' );
while( $query2->have_posts() ) {
$query2->the_post();
echo the_title();?> </br>
}
Very stupid I know but been searching for over 2 hours alrdy :( must be passing it wrong somehow tried everything from echo, to just $zoekterm to 's='$zoekterm' ' etc...

"s=$zoekterm"too? Note the double quotes. – toscho♦ Jul 12 '12 at 18:25