• Hello, and thanks in advance for your support. Is there a way to search in titles only? I mean not in the headlines and in the full post, just in the titles.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gfiorear

    (@gfiorear)

    I could achive this by making the following changes:

    File: wp-includes/query.php

    REPLACE:

    $search .= “{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}

    WITH:

    $search .= “{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) )”;

    REPLACE:

    $search .= ” OR ($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}’)”;

    WITH:

    $search .= ” OR ($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) “;

    this is what i’ve been looking for! ?? but do you know what i would change to search using tags? i.e. change post.post_content to post.post_tags (although its not this cos i’ve tried it!)

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search titles only’ is closed to new replies.