Query Posts keyword

16 August 2011 | Tips & Tricks | Tags: ,

While I was creating a search function in WordPress I found it hard to filter query_posts with a keyword. Then I simply tried to add &s=keyword and it worked. So for all you out there, having the same problem here is a pice of code how to make this work:

<?php

global $query_string;

$keyword = “my epic keywords”;

query_posts( $query_string . “&s=”.$keyword );

?>


Leave a Reply