2つのカスタム投稿タイプに2つのカスタム分類を適用しています。サイドバーの用語リストは問題なく、それに関連するすべての投稿をリストします。ただし、特定の用語のいずれかを検索した場合、その用語を含む投稿は表示されません。
例:http : //dev.andrewnorcross.com/das/all-case-studies/用語「PQRI」の検索
何も得られません。何か案は?さまざまな検索プラグインを使用してみましたが、カスタム検索パラメーターが壊れているか、機能しません。
2つのカスタム投稿タイプに2つのカスタム分類を適用しています。サイドバーの用語リストは問題なく、それに関連するすべての投稿をリストします。ただし、特定の用語のいずれかを検索した場合、その用語を含む投稿は表示されません。
例:http : //dev.andrewnorcross.com/das/all-case-studies/用語「PQRI」の検索
何も得られません。何か案は?さまざまな検索プラグインを使用してみましたが、カスタム検索パラメーターが壊れているか、機能しません。
回答:
Search Everythingプラグインもお勧めしますが、WPの検索機能を使用してこれを実装する場合は、Atomテーマで使用しているコードを以下に示します。
// search all taxonomies, based on: http://projects.jesseheap.com/all-projects/wordpress-plugin-tag-search-in-wordpress-23
function atom_search_where($where){
  global $wpdb;
  if (is_search())
    $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')";
  return $where;
}
function atom_search_join($join){
  global $wpdb;
  if (is_search())
    $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id";
  return $join;
}
function atom_search_groupby($groupby){
  global $wpdb;
  // we need to group on post ID
  $groupby_id = "{$wpdb->posts}.ID";
  if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby;
  // groupby was empty, use ours
  if(!strlen(trim($groupby))) return $groupby_id;
  // wasn't empty, append ours
  return $groupby.", ".$groupby_id;
}
add_filter('posts_where','atom_search_where');
add_filter('posts_join', 'atom_search_join');
add_filter('posts_groupby', 'atom_search_groupby');Tag-Searchプラグインに基づいています:http : //projects.jesseheap.com/all-projects/wordpress-plugin-tag-search-in-wordpress-23
is_search()やその他のWP_Queryメソッド呼び出し(is_search() is_home()など)は常にクエリインスタンスで直接呼び出す必要があります(たとえば$query->is_search()、インスタンス変数の名前が$queryコールバックシグネチャにあると仮定)。、フィルターが実行されているクエリではありません。
                    これは標準のWordPress検索ですか?それは、検索に分類法(カテゴリやタグなどの標準さえも)を含まないようだからです。コードでの検索post_titleやpost_content、しかし、あなたがにフックする必要があり、何含めたい場合はposts_search、フィルタを。
https://wordpress.stackexchange.com/a/5404/37612の上のOnetrickponyの解決策を試してみましたが、それは素晴らしいことですが、そこに1つの問題が見つかりました。
分類にドイツ語の「ウムラウト」(ö、ä、ü)などの特殊文字があり、特殊文字を使用するoe、ae、ue instedaを検索する場合-分類のスラッグに検索を追加する必要があります- 
OR t.slug LIKE '%".get_search_query()."%'
検索クエリと分類フィルターの組み合わせを検索する場合-これも正常に動作します
しかし、問題は、分類フィルターのみを使用しようとすると、テキストが検索されない場合、検索フックが空の文字列をクエリに追加するため、結果からすべての投稿が取得され、フィルタリングされた分類。簡単なIFステートメントで問題を解決します。したがって、変更されたコード全体はこれになります(私にとっては完璧に動作します!)
関数custom_search_where($ where){ 
  グローバル$ wpdb;
  if(is_search()&& get_search_query())
    $ where。= "OR((t.name LIKE '%"。get_search_query()。 "%' OR t.slug LIKE '%"。get_search_query()。 "%')AND {$ wpdb-> posts} .post_status = '公開') ";
  $ whereを返します。
}
関数custom_search_join($ join){
  グローバル$ wpdb;
  if(is_search()&& get_search_query())
    $ join。= "LEFT JOIN {$ wpdb-> term_relationships} tr ON {$ wpdb-> posts} .ID = tr.object_id INNER JOIN {$ wpdb-> term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id INNER JOIN { $ wpdb-> terms} t ON t.term_id = tt.term_id ";
  return $ join;
}
関数custom_search_groupby($ groupby){
  グローバル$ wpdb;
  //投稿IDでグループ化する必要があります
  $ groupby_id = "{$ wpdb-> posts} .ID";
  if(!is_search()|| strpos($ groupby、$ groupby_id)!== false ||!get_search_query())return $ groupby;
  // groupbyは空でした。
  if(!strlen(trim($ groupby)))return $ groupby_id;
  //空ではありませんでした。
  return $ groupby。 "、"。$ groupby_id;
}
add_filter( 'posts_where'、 'custom_search_where');
add_filter( 'posts_join'、 'custom_search_join');
add_filter( 'posts_groupby'、 'custom_search_groupby');
              Janと同じレベルの情報を持っています。プラグインで検索を拡張することも可能です。
おそらくすべてを検索(Wordpressプラグイン)はあなたが探しているものです。機能リストによると、カスタム分類をサポートするようになりました。
onetrickponyからの答えは素晴らしいとわかりましたが、検索はすべて単一の用語として扱われ、引用符で囲まれた検索フレーズも処理しません。atom_search_whereこれらの2つの状況に対処するために、彼のコード(具体的には関数)を少し変更しました。ここに彼のコードの修正版があります:
// search all taxonomies, based on: http://projects.jesseheap.com/all-projects/wordpress-plugin-tag-search-in-wordpress-23
function atom_search_where($where){ 
    global $wpdb, $wp_query;
    if (is_search()) {
        $search_terms = get_query_var( 'search_terms' );
        $where .= " OR (";
        $i = 0;
        foreach ($search_terms as $search_term) {
            $i++;
            if ($i>1) $where .= " AND";     // --- make this OR if you prefer not requiring all search terms to match taxonomies
            $where .= " (t.name LIKE '%".$search_term."%')";
        }
        $where .= " AND {$wpdb->posts}.post_status = 'publish')";
    }
  return $where;
}
function atom_search_join($join){
  global $wpdb;
  if (is_search())
    $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id";
  return $join;
}
function atom_search_groupby($groupby){
  global $wpdb;
  // we need to group on post ID
  $groupby_id = "{$wpdb->posts}.ID";
  if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby;
  // groupby was empty, use ours
  if(!strlen(trim($groupby))) return $groupby_id;
  // wasn't empty, append ours
  return $groupby.", ".$groupby_id;
}
add_filter('posts_where','atom_search_where');
add_filter('posts_join', 'atom_search_join');
add_filter('posts_groupby', 'atom_search_groupby');WooCommerceカートプラグインでも同じ問題が発生します。標準の投稿タグではないため、検索結果にカスタム分類用語「product_tag」が含まれていません。この他のStackOverflowスレッドでこの問題に関する解決策を見つけました。
tkellyのコード例は、カートプラグインのニーズに応じて、author彼の例の用語を置き換えるときに機能しましたproduct_tag。