Every custom field can be set as a filters’ source data. However, these fields must be first registered – this process is not done automatically. Our integrations with third-party plugins, such as Advanced Custom Fields, are the exception. In this case, custom fields will be immediately selectable as a data source.
To make any custom field selectable from the Data source dropdown, you need to register them with this PHP snippet:
add_filter( 'fibofilters/filters/custom_sources/custom_fields', function ( $custom_fields ) { $custom_fields[] = [ 'field_slug' => 'size', // meta_key 'label' => 'My custom field: Size', 'label_front' => 'Size', ]; return $custom_fields; } );
In the example above, a field is registered, whose meta_key
in the postmeta table is size
.
After adding this snippet, a new position “My custom fields: Size” should be selectable from the Data source dropdown: