Forums Forums Search & Filter Pro Filter by custom field

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

    I have a custom post type with an ACF field that is a select field containing multiple values. The field shows up in the S&F post meta as a meta key name, and I added the select field’s values as options in the S&F post meta.

    The All Items selection in S&F displays all of the posts from my custom post type, but the option values are not filtering the post meta options.

    Any ideas?

    Anonymous
    #29453

    Ah, I found there are 2 choices in the post meta for the ACF field. You have to choose the one without the underscore. Also noticed that you have to choose Field Groups in the post types.

    Anonymous
    #29456

    And now it has quit working.

    Ross Moderator
    #29582

    Hi Sam

    Usually you have to choose the field without the underscore – try using the “Auto Suggest” feature on both versions – the one that gives some desired and valid options will be the one you should use.

    Also, when you change the meta key, the S&F cache has to be rebuilt – check the status of the cache.

    If the cache has not completed building – none of your filters will work.

    Let me know how you get on with that and we can take it from there.

    Also, I’ve never actually included the “Field Groups” option in any of my ACF testing.

    Thanks

    Anonymous
    #29669

    I tried turning off the “Field Groups” just to see if it still works but now I am getting a “Warning: Cannot modify header information – headers already sent” error when I try to update S&F.

    Ross Moderator
    #29672
    This reply has been marked as private.
    Anonymous
    #29689

    Error fixed. Not related to S&F. Sorry. I am now able to turn off Field Groups and everything is working fine.

    Why does S&F not work with a standard loop?
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    Ross Moderator
    #29690

    Hey Sam

    S&F does work with the standard loop in Archive or Post Type Archive results modes.

    The thing is, in this case your template might have a custom query somewhere in template itself or in the theme files which overwrites the default loop:

    http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/#h-bad-template

    You could try to add this largely undocumented action:

    <?php do_action("search_filter_archive_query", 749); ?>

    Just before your have_posts – which should replace the global $wp_query – replace 749 with the ID of your search form.

    Thanks

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