Support » Plugin: ACF: Better Search » plugin breaks search (woocommerce products)

  • Hi,

    I just installed and configured your plugin cause I need it to search inside Woocommerce products custom fields.

    When I activate and configure the plugin the search function doesnt work anymore.


    return 2 results when the plugin is deactivated
    and 0 when it is activated…

    any ideas?

    thanks in advance

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


    Hi @igarciaoliver,

    Please add new lines in functions/search.php file below line:
    $sql = str_replace(‘SELECT’, ‘SELECT DISTINCT’, $sql);

    New lines:
    echo ‘

    echo '


    Please send me output SQL query.

    hi @mateuszgbiorczyk

    I did that and got the following print.
    FYI, it is working on my localhost but not on my server (buehost). I can paste php_info if needed!

    Thanks for your help.

    SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_tillex_posts.* FROM wp_tillex_posts LEFT JOIN wp_tillex_term_relationships ON (wp_tillex_posts.ID = wp_tillex_term_relationships.object_id) LEFT JOIN wp_tillex_postmeta AS a ON (a.post_id = wp_tillex_posts.ID) LEFT JOIN wp_tillex_postmeta AS b ON (b.post_id = wp_tillex_posts.ID) LEFT JOIN wp_tillex_posts AS c ON ((c.post_type = 'acf-field') AND ((c.post_content LIKE '%:"text"%') OR (c.post_content LIKE '%:"textarea"%') OR (c.post_content LIKE '%:"file"%') OR (c.post_content LIKE '%:"wysiwyg"%'))) LEFT JOIN wp_tillex_posts AS d ON ((c.post_content LIKE '%:"file"%') AND (d.ID = b.meta_value)) WHERE 1=1 AND ( wp_tillex_term_relationships.term_taxonomy_id IN (15) AND wp_tillex_posts.ID NOT IN ( SELECT DISTINCT object_id FROM wp_tillex_term_relationships WHERE term_taxonomy_id IN (6) ) )AND (((a.meta_value LIKE '%8339345629%') AND (b.meta_id = a.meta_id + 1) AND (c.post_name = b.meta_value)) OR ((wp_tillex_posts.post_title LIKE '%8339345629%') OR (wp_tillex_posts.post_content LIKE '%8339345629%') OR (wp_tillex_posts.post_excerpt LIKE '%8339345629%')) OR (d.post_title LIKE '%8339345629%')) AND wp_tillex_posts.post_type = 'product' AND (wp_tillex_posts.post_status = 'publish' OR wp_tillex_posts.post_status = 'acf-disabled' OR wp_tillex_posts.post_status = 'private') GROUP BY wp_tillex_posts.ID ORDER BY wp_tillex_posts.post_title LIKE '{615dce90fbbfc527599047640cac3aa5d09673629d0f9ae9133eeb64d21f2333}8339345629{615dce90fbbfc527599047640cac3aa5d09673629d0f9ae9133eeb64d21f2333}' DESC, wp_tillex_posts.post_date DESC LIMIT 0, 30

    Plugin Author Mateusz Gbiorczyk


    Hi @igarciaoliver,

    Can you check it on different hosting?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘plugin breaks search (woocommerce products)’ is closed to new replies.