The functions the_permalink()
and the_title()
print their results by default. Use get_permalink()
and get_the_title()
instead:
while($query->have_posts()){
$query->the_post();
$url = get_permalink();
$keyword = get_the_title();
Print('<p>' . $url . '{' . $keyword . '}' . '</p><br>');
}