Can I filter by an ACF field or other custom postmeta?
Published
Filtering works best on taxonomies and attributes, because those give fast, accurate counts. Postmeta doesn’t – so the best approach is to convert the value into a global attribute or taxonomy (you can keep the postmeta too, for the product page). If you must filter on raw meta, you can define the meta keys in wp-config.php and rebuild:
define('SSF_META_KEYS', array('author', 'second_key'));
Then run wp ssf rebuild; the keys appear at the bottom of the Taxonomy dropdown in the widget (only if data exists). Use the real meta_key – for ACF that’s the field name, not the field_xxxx key (verify with SELECT * from wp_postmeta where meta_key = 'x' LIMIT 10;). Serialized/array values aren’t supported; deserialize to a plain string or migrate to a taxonomy.
Still stuck? Post a screenshot on our Discord.
Further reading
every other known problem and its fix.
setting up and configuring the filters.
Comments