Saturday, June 15, 2013

wordpress meta value search(Multisite Global Search plugin)

Multisite global search You can search meta value, just add this code in shortcodes.php
$termsearch = "( post_title LIKE '%%".$term."%%' OR post_content LIKE '%%".$term."%%' OR ".$wpdb->base_prefix."v_postmeta.meta_value LIKE '%%".$term."%%' ) ";
 $request = $wpdb->prepare( "SELECT ".$wpdb->base_prefix."v_posts.* from ".$wpdb->base_prefix."v_posts left join ".$wpdb->users." on ".$wpdb->users.".ID=".$wpdb->base_prefix."v_posts.post_author ". " LEFT JOIN ".$wpdb->base_prefix."v_postmeta ON(".$wpdb->base_prefix."v_posts.ID = ".$wpdb->base_prefix."v_postmeta.post_id)".


No comments:

Post a Comment