Forums Forums Search & Filter Pro Taxonomy not working for custom post type

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #76399

    Hello!

    I’ve been testing Search & Filter Pro with a custom post type. Ajax seems to work correctly while using a regular search text and/or using Sort Order, but when I use a Taxonomy, ajax doesn’t work. I’ve looked over the code and added some console.log/echo/print_r checks in order to find out where the issues were happening. In looking at the Ajax URL, there are a number of WP_Errors, mostly pointing to the slug and term_d, both found in the class-search-filter-cache.php file. When writing out the error, I am seeing an “Invalid taxonomy” message. I haven’t done anything special, I am using the default results display with the display results method being: “Using a Shortcode”.

    Here’s one of the error messages:

    Notice: Undefined property: WP_Error::$slug in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\search-filter-pro\public\includes\class-search-filter-cache.php on line 385

    Can you give me any insight into what might be going on?

    As a side note, I am currently running this on localhost.

    Thanks!

    Josh

    Trevor
    #76464
    This reply has been marked as private.
    Trevor
    #76578
    This reply has been marked as private.
    Anonymous
    #77076
    This reply has been marked as private.
    Ross Moderator
    #77856

    Hey Josh

    Sorry for the delay on this..

    So I took a look and makes sense.

    As you mentioned, it seems like the taxonomy may not be initialised properly – can I ask, how is this taxonomy created and on what action/filter is it hooked onto?

    I believe taxonomies should be added on the init action – which should work for S&F ajax requests like this..

    BTW have you done anything at all to the search form, such as add on JS that styles the search form, or even edited any plugin files?

    I guess you already came to the same conclusion which is that it looks like our JS is not finding a HTML element it expects to be there (within the ajax request), and this is because the taxonomy is not initialised yet so the html is not generated.

    BTW if you add define("SEARCH_FILTER_DEBUG", true"); to your wp-config so we will be using the uncompressed JS files so we can get a better idea of exactly where the JS error is coming from.

    Thanks

    Anonymous
    #77901

    Ross,

    No worries on the delay. I appreciate you taking the time to look into it.

    After doing some looking, I was able to track down the issue. In my initial research, it seemed that the issue was related to init, but I wasn’t sure. After I was able to find the action hook and change it to init, everything worked correctly.

    I had made a number of changes in S&F at first, writing out values to track things down. I logged the ajax URL to the console window and was then able to see the errors that related to the taxonomy not being valid. This lead me to the init issue. I had made the wp-config changes locally, so I was able to test locally, just forgot when I pushed everything to the test site.

    The code that was on the test site had not been changed. I think the JS error was due to the errors that were being returned in the ajax call. The errors prevented the JSON from formatting correctly, which caused the error.

    I really appreciate all of your help, and feel bad that I wasted your time.

    If you need anything from me (review, etc…), please let me know.

    Have a great rest of your week.

    Have a Merry Christmas and a Happy New Year!

    Thanks,

    Josh

    Trevor
    #77966

    Hey Josh. Happy Holidays to you too!!

    Can I close this thread as resolved?

    and the review page is here:

    http://www.designsandcode.com/wordpress-plugins/search-filter-pro/reviews/#comment

    Anonymous
    #78007

    Trevor,

    You can certainly close this thread.

    Thank you for all of your help. It was a pleasure talking to you.

    Thanks,

    Josh

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