Forum: Premium Settings

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support related to the Premium Settings premium extension please open a new premium support ticket.

[Resolved]Taxonomy and Custom Field Filters Not Working

Home Forums Premium Settings Taxonomy and Custom Field Filters Not Working

This topic contains 7 replies, has 2 voices, and was last updated by  amndesign 3 years, 3 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #52511

    amndesign
    Participant

    Around a year ago, I created a customized search form and results page that utilize a handful of custom taxonomies created for a client site. This used to work fine and somewhere along the way, I assume after a plugin update, it stopped working and now the taxonomy and custom field filters return all available results. The keyword and address filters work as expected; however, taxonomy filters for Category, Age and Date do not. If you can point me in the right direction as to what may have changed and cause the issue, I would be greatly appreciate it.

    Private Content Hidden
    Attachments:
    You must be logged in to view attached files.
    #52516

    Eyal Fitoussi
    Keymaster

    Hello Adam,
    1) Have you tried to changing to a default search form/search results template files to see if the issue is in the custom template files?

    2) Did you also add any custom functions ( possibly in the functions.php file ) that modify the taxonomies or search query via GEO my WP hooks?

    #52531

    amndesign
    Participant

    Hi Eyal,

    Thank you for your response. It’s very much appreciated.

    1) Yes, this what the first thing I tried and I had the same issue.

    2) This seems to be the issue. I’ve added the following functions – see below – if these are removed the form works. However, we need to ensure that regardless of whether or not a user has entered a value for “Starts on or after” that we only display current and futures activities, not those that have take place in the past. Any thoughts?

    We also have this Order by function that’s not working:

    #52535

    amndesign
    Participant

    Having an issue with the code formatting, so I’ve uploaded a file.

    Attachments:
    You must be logged in to view attached files.
    #52542

    Eyal Fitoussi
    Keymaster

    You are welcome Adam,

    IN the first script where you modify the WP Query, instead of doing:

    which is modifying/resetting the entire query args. You should try modifying only the specific args that you need. So doing something like the below might work:

    Let me know if that helps.

    #52552

    amndesign
    Participant

    Thanks again for the response. Unfortunately, that’s not doing the trick. I’ve completely removed the function and am setting outdated entries to private status so they won’t display. Ideally, we wouldn’t have to rely on manually editing these, but I can’t the query modification in functions.php to work in harmony with the search form filters, possibly because the form also offers filtering by date, which is the value we’re keying off of in functions.php.

    Separately this order by filer also wasn’t working, even with removing the other function: http://docs.geomywp.com/posts-locator-order-by-filter/

    #52582

    Eyal Fitoussi
    Keymaster

    OK, Just to understand better. You right now have two custom functions in the functions.php file:

    1) Function above that attached to the ‘gmw_pt_search_query_args’ filter.

    2) The orderby custom function attached to the ‘gmw_pt_location_query_clauses’ filter.

    Am I right?

    You also said that removing the custom function everything works again. Have you tried removing one functions at a time to see if a specific function causes the search issue?

    #52649

    amndesign
    Participant

    Correct. There are two functions. Removing the function attached to the ‘gmw_pt_search_query_args’ filter is what solved the issue. I think the problem was that this function is attempting to filter the posts based on a date value in a custom field, and then we are attempting to “re-filter” by date using that same custom field value with form. Does that make sense?

    1) Yes. add_filter( 'gmw_pt_search_query_args', 'gmw_modify_query_by_date', 10, 2 );

    2) The portion of code attaching this to the filter was missing and this is why the orderby was not working. My bad. I’ve updated this and the orderby funtion works.

    Thanks!

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Taxonomy and Custom Field Filters Not Working’ is closed to new replies.