Enter your keyword

Blog

Search / Filter posts on Title/Content/Taxonomy and Tags

<?php 
$searchkeys = 'searchkeyword';
global $wpdb;
$querysearch=" SELECT * FROM $wpdb->posts, $wpdb->term_relationships, $wpdb->term_taxonomy, $wpdb->terms WHERE ($wpdb->terms.name = '$searchkeys' OR $wpdb->posts.post_content LIKE '%$searchkeys%' OR $wpdb->posts.post_title LIKE '%$searchkeys%') AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.ID = $wpdb->term_relationships.object_id AND  $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id ORDER BY $wpdb->posts.post_date DESC";

$get_results = $wpdb->get_results($querysearch, OBJECT_K);
?>

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.