Support » Plugin: Filters - An Enhanced UI for Post management » Add custom fields to filtering/ search results?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Scott Kingsley Clark


    What custom fields do you want added? What types of fields are they?

    I have one custom type “Directory” and it has “Country”, “State”, “City” and others dropdown custom types related

    Plugin Author Scott Kingsley Clark


    What’s the post type name? “directory”?

    What plugin did you use to build the fields for it?

    Get me a full list of the fields you want filtered, I need the meta_key name and the label you want for it, along with the type of field.

    I’m using “Ultimate Post Type Manager” ( for creating the custom types:

    directorio (Directory)
    dire_pais (Country)
    dire_estado (State)
    dire_municipio (City)

    dire_pais, dire_estado and dire_municipio custom types are related to “directorio” using related custom fields created with “Advanced Custom Fields” plugin (

    The custom fields are:
    meta_key name: pais, type: relation, post_type: dire_pais
    meta_key name: estado, type: relation, post_type: dire_estado
    meta_key name: municipio, type: relation, post_type: dire_municipio

    Plugin Author Scott Kingsley Clark


    What do the meta values look like for the relationships? Are they IDs?

    Yes, are IDs

    Plugin Author Scott Kingsley Clark


    Filters v0.3 now has Custom Field Suite support built in for it’s fields, alongside the Pods integration it had before.

    I’m open to adding ACF support, can you provide the PHP used to get fields for a specific post type?

    Here’s the code I added for CFS support:

    if ( is_object( $cfs ) ) {
    		$rules = array(
    			'post_types' => $post_type
    		$groups = $cfs->api->get_matching_groups( $rules );
    		$cfs_fields = array();
    		$cfs_filters = array();
    		if ( !empty( $groups ) ) {
    			$groups = array_keys( $groups );
    			$cfs_inputs = $cfs->api->find_input_fields( array( 'post_id' => $groups ) );
    			// needs Pods-style field array
    			if ( !empty( $cfs_inputs ) ) {
    				foreach ( $cfs_inputs as $cfs_input ) {
    					$cfs_fields[ $cfs_input[ 'name' ] ] = array(
    						'name' => $cfs_input[ 'name' ],
    						'label' => $cfs_input[ 'label' ],
    						'type' => 'text',
    						'from' => 'cfs'
                $cfs_filters = apply_filters( 'filters_cfs_filters', null, $groups, $cfs_inputs );
                if ( null === $cfs_filters || false === $cfs_filters )
                    $cfs_filters = array_keys( $cfs_fields ); // allow filters for all fields
                elseif ( empty( $filters ) )
                    $cfs_filters = array();
    		$fields = array_merge( $fields, $cfs_fields );
    		$filters = array_merge( $filters, $cfs_filters );

    Hi your plugin is great but I am also looking into having the option of searching custom fields.

    I have 3 fields which I would like to add to the pop up screen ( or have a dropdown with all custom fields and then free text) can you kindly advise on how best to proceed. Aside from that I would also need to search by author.

    Thanks !!

    Plugin Author Scott Kingsley Clark


    This plugin isn’t heavily documented, I haven’t had time to put resources on it because it’s actually just been isolated from the Pods project which has it’s own filter handling automatically without needing for extending.

    With that said, I’ll add this to my to-dos to get to you, I can’t gaurantee a timeline, you may be better off looking at the code and finding the WP hook to filter the fields / filters available.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add custom fields to filtering/ search results?’ is closed to new replies.