Welcome Guest, Not a member yet? Register   Sign In
Searching Wordpress database - Post tags question?
#1

[eluser]BobbyB[/eluser]
Hey, I am trying to search a wordpress database for articles.
This is my model:
Code:
function serach($term,$limitstart,$limitend,$db)
{    
    $posts = array();
    
     $db->where('post_status','publish');
     $db->where('comment_status','open');
     $db->where('(post_content LIKE "%'.$term.'%" OR post_title LIKE "%'.$term.'%")');
     $db->order_by('post_date', 'desc');
     $db->limit($limitend,$limitstart);
    
    $query = $db->get('wp_posts');
     if ($query->num_rows() > 0) {
          $posts = $query->result_array();
    }
    return $posts;
    
    }

It works great (searches both the title/content) but I would like to also include the posts' tags in my search.
Has anybody done this before?
I have looked into the wordpress database, but could not find a way to make it work.
Any help appreciated!
Thnx!




Theme © iAndrew 2016 - Forum software by © MyBB