Can't use tags or categories as search criteria

  • Author
  • #944172


    I’m setting up a private blog for family only, and I discover after a great deal labour already applied that the Tags are not read by the search widget. For example, If the entry something like “Last Saturday at Lake Greenish”, and the content is “Someone ate far too many sausages, didn’t they?”, with tags of “Uncle Fred, Mort, Ginger”, after publishing I can enter “sausage” into the seach widget and get the entry, but “Mort” produces a NO ARTICLES FOUND result, which is rather disheartening, as the whole point of the enterprise was to be able to search by tab and category. The category problem is less pressing because one can just have the drop-down list of them in the sidebar, but for tags there’s just the Tag Cloud, and some tags aren’t popular enough to appear in it.

    The blog I need help with is



    True. That’s why I never use tags, but have over 400 categories. The search doesn’t search tags and categories, but Google does. Unfortunately you can’t use Google on a private blog.



    hi ravensmarch,

    i too have the same problem but i put custom query to search.php that help me find the desired result. here is the query that i used

    global $wpdb;

    $querystr = "
    SELECT wposts.* FROM $wpdb->posts wposts
    INNER JOIN $wpdb->term_relationships ttr ON wposts.ID = ttr.object_id
    INNER JOIN $wpdb->term_taxonomy trm ON ttr.term_taxonomy_id = trm.term_taxonomy_id
    INNER JOIN $wpdb->terms tm ON tm.term_id = trm.term_id
    WHERE ( LIKE '%".$_REQUEST['s']."%' OR wposts.post_title LIKE '%".$_REQUEST['s']."%' OR wposts.post_content LIKE '%".$_REQUEST['s']."%') AND wposts.post_status = 'publish' AND wposts.post_type ='post' GROUP BY wposts.ID ORDER BY wposts.post_date";

    $pageposts = $wpdb->get_results($querystr, OBJECT);

The topic ‘Can't use tags or categories as search criteria’ is closed to new replies.