Support » Plugin: ACF: Better Search » Search without Default WordPress Conditions

  • Resolved Kipperlenny

    (@kipperlenny)


    acf-better-search/app/Search/Where.php on line 36

    A config switch to disable getDefaultWordPressConditions() would be nice.
    You already added the filter acfbs_search_post_object_fields – but if I return an empty array on this filter, the SQL is wrong:

    ......OR (a.meta_value LIKE '%63517%')) OR (() AND () AND () AND () AND () AND ().....

    because you do not check for empty $conditions in function getDefaultWordPressConditions() ->

    $list[] = '(' . implode(' OR ', $conditions) . ')';

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @kipperlenny,

    Thank you for your message.

    Unfortunately, this option is not currently available, but I will take this into account in future updates.

    Remember that you can filter from WordPress with a higher priority than me in the plugin and perform such functionality yourself.

    Thread Starter Kipperlenny

    (@kipperlenny)

    But you could at least fix the “if filter is returning empty fields array” thing.
    Just:

    
    if(!empty($conditions)) {
        $list[] = '(' . implode(' OR ', $conditions) . ')';
    }
    

    instead of

    $list[] = '(' . implode(' OR ', $conditions) . ')';

    will help everyone trying to use your acfbs_search_post_object_fields filter 🙂

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you very much for your application. I will definitely add it in the next version of the plugin.

    Thread Starter Kipperlenny

    (@kipperlenny)

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search without Default WordPress Conditions’ is closed to new replies.