Support » Plugin: Search Everything » [Plugin: Search Everything] Not working for custom taxonomies

  • Hi

    I have defined a custom post type called Artwork, with several non-hierarchical custom taxonomies (tags) assigned to it.

    Search Everything doesn’t seem to be searching these taxonomies, even with the option set to Yes.

    E.g. I have several Artworks tagged ‘Sea’, but if I search for Sea it only returns Artworks that have Sea in the title or content.

    Many thanks
    Simon

Viewing 6 replies - 1 through 6 (of 6 total)
  • Just chiming in that I’ve had this issue too. Looks like it is the combo of a custom post type and a custom taxonomy. A quick hack to search-everything.php shows you can customize the post type and the taxonomy to make a search work (lines 750-754).

    Here’s my edited bit of code that seems to work for specific custom post types and custom taxonomies in case it is helpful (starts at line 748):

    // if we're searching custom taxonomies
    if ( $this->options['se_use_tax_search'] )
    {
    $post_taxonomies = get_object_taxonomies('posts');
    $gallery_taxonomies = get_object_taxonomies('gallery-posts');
    $nonprofit_taxonomies = get_object_taxonomies('nonprofit-posts');
    $all_taxonomies = array_merge($post_taxonomies, $gallery_taxonomies, $nonprofit_taxonomies);
    foreach ($all_taxonomies as $taxonomy)
    {
    if ($taxonomy == 'post_tag' || $taxonomy == 'category' || $taxonomy == 'gallery_tags'  || $taxonomy == 'issue_categories' || $taxonomy == 'region' || $taxonomy == 'country' || $taxonomy == 'nonprofit_tags' || $taxonomy == 'np_region' || $taxonomy == 'np_country' || $taxonomy == 'np_issue' )
    continue;
    $on[] = "ttax.taxonomy = '".addslashes($taxonomy)."'";
    }
    }
    Justin Sternberg

    (@jtsternberg)

    same problem! i’ll try this method.

    Justin Sternberg

    (@jtsternberg)

    i replaced the existing code in the plugin with the code you provided, and then replaced the custom post types, and custom taxonomies you have listed with my own… no luck!

    Why is so difficult to search custom taxonomies??

    This has been driving we crazy for a while as well, although I made a tweak that seems to get it working. The above code didn’t work for me either, but editing those same lines from search-everything.php like this did:

    if ( $this->options['se_use_tax_search'] )
    {
    $all_taxonomies = get_object_taxonomies('review');
    foreach ($all_taxonomies as $taxonomy)
    {
    if ($taxonomy == 'post_tag' || $taxonomy == 'category')
    continue;
    $on[] = "ttax.taxonomy = '".addslashes($taxonomy)."'";
    }
    }

    All I did was change the line:
    $all_taxonomies = get_object_taxonomies('post');
    to this
    $all_taxonomies = get_object_taxonomies('review');

    Where ‘review’ is a registered post-type of mine, and now it searches all of my different post types as well (not sure why). Quite sure this isn’t the best way to go about it, but it works for now!

    i’ve moved to relevanssi (http://wordpress.org/extend/plugins/relevanssi) – problem sorted!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Search Everything] Not working for custom taxonomies’ is closed to new replies.