Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Web page in question: http://www.cambridgesca.org.uk/ExternalDirectory/searchdirectory/

Plug-in used: Search & Filter

Frequencies is a custom taxonomy. Code, as follows, inserted at the end of functions.php in the theme folder.

add_action( 'init', 'register_taxonomy_frequencies' );

function register_taxonomy_frequencies() {

    $labels = array( 
        'name' => _x( 'Frequencies', 'frequencies' ),
        'singular_name' => _x( 'Frequency', 'frequencies' ),
        'search_items' => _x( 'Search Frequencies', 'frequencies' ),
        'popular_items' => _x( 'Popular Frequencies', 'frequencies' ),
        'all_items' => _x( 'All Frequencies', 'frequencies' ),
        'parent_item' => _x( 'Parent Frequency', 'frequencies' ),
        'parent_item_colon' => _x( 'Parent Frequency:', 'frequencies' ),
        'edit_item' => _x( 'Edit Frequency', 'frequencies' ),
        'update_item' => _x( 'Update Frequency', 'frequencies' ),
        'add_new_item' => _x( 'Add New Frequency', 'frequencies' ),
        'new_item_name' => _x( 'New Frequency', 'frequencies' ),
        'separate_items_with_commas' => _x( 'Separate frequencies with commas', 'frequencies' ),
        'add_or_remove_items' => _x( 'Add or remove Frequencies', 'frequencies' ),
        'choose_from_most_used' => _x( 'Choose from most used Frequencies', 'frequencies' ),
        'menu_name' => _x( 'Frequencies', 'frequencies' ),
    );

    $args = array( 
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => true,
        'show_admin_column' => true,
        'hierarchical' => true,

        'rewrite' => true,
        'query_var' => true
    );

    register_taxonomy( 'frequencies', array('post'), $args );
}

"Frequencies" is hierarchical, "type of work" is not.

All posts have Frequency assigned.

If I search for Type of work + Frequency (weekly + hospitality), I get results (in this case, 2 posts).

If I search for Type of work ONLY (hospitality), I get results.

If I search for Frequency (weekly) I get an error message (probably 404).

I also noticed that post pages do not list Frequency in their meta data (post created, tags such and such). I do not know if the failed query has anything to do with the absent meta data.

Could you please advise me what code I need to implement (and which file / location it needs to go into) to get the query working on custom taxonomy?

EDIT: Code for the Search & Filter plugin is available through github, as far as I can tell the most relevant part to troubleshoot this problem is https://github.com/rmorse/search-filter/blob/master/search-filter.php

Sadly, I am not a code-monkey; I can understand simple commands but I get lost when dealing with complex data.

share|improve this question
    
What is your search query code? –  s_ha_dum May 16 at 16:26
    
I don't know where to find it, so I can't answer your question. I think this might be a solution [wordpress.stackexchange.com/questions/60330/…, but I don't know how to implement it, and whether I'd need to do it with every new taxonomy. –  Cambridge Sca May 16 at 16:35
    
"If I search for..."-- how are you searching? –  s_ha_dum May 16 at 16:36
    
Using the UI on this website [cambridgesca.org.uk/ExternalDirectory/searchdirectory/]. Weekly + hospitality's url is [cambridgesca.org.uk/ExternalDirectory/… and renders correct results. Weekly [cambridgesca.org.uk/ExternalDirectory/… or [cambridgesca.org.uk/ExternalDirectory/frequencies/… renders 404 –  Cambridge Sca May 16 at 16:41
    
That is far from a Core supplied search form. I am pretty sure you are going to need to track down the code that processes that form. –  s_ha_dum May 16 at 16:43

1 Answer 1

up vote 0 down vote accepted

Resetting permalinks, as per this thread, fixed this problem.

Visit Settings -> Permalinks -> Save current settings

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.