• Creator
  • #21342
    Resolved EricHedvat

    Ive seen a previous thread on connecting facetwp to custom table fields from 2 yrs ago, but no conclusive answer.

    Inside facetwp plugin folder there is a file class-helper.php, with this line:

    // Get custom fields
    $meta_keys = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} ORDER BY meta_key" );

    Since I am storing my meta fields/values in a custom table, will it be enough to just change this line? And what should it be changed to?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #21346
    Long Nguyen

    Hi Eric,

    The extension Meta Box - FacetWP Integrator also supports to index the post which has the field's value save in the custom table. See my screen record https://www.loom.com/share/bfee1ed88ef04a33bf79c16147898163.

    If you want to customize more, please follow the developer documentation of Facet https://facetwp.com/documentation/developers/.


    Thanks it works, makes sense.

    Related to this however, I have tried to create a 'Proximity' Facet which connects to the google maps metabox field - the LAT/LONG of the address. It doesnt seem to work, nor does it register the location coordinates in the facetwp index table in db.

    here is my map field

                    'id'            => $prefix . 'map_lat_long',
                    'type'          => 'map',
                    'name'          => esc_html__( 'Map', 'text-domain' ),
                    'address_field' => 'building_address',
                    'api_key'       => '...',
                    'region'        => '.us',
                    'std'           => '40.7831, -73.9712,14',


    Long Nguyen


    FacetWP can’t filter by maps. You should make it filter by other fields (cities, wards, etc.), and the map will be displayed accordingly.

    Refer to this topic https://metabox.io/support/topic/render-openstreetmap-for-archive-pages-elementor-or-any/.


    The documentation states it can filter by lat/long: https://facetwp.com/documentation/facets/facet-types/proximity/

    It also says "The Data Source should be a custom field containing a comma-separated latitude, longitude."
    My map field in the custom table is stored exactly like this (provided an address is selected via the building_address field.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.