I have a field called "Floorplan Names Select" it is populated with the following code:
This currently grabs the names of posts defined as a floorplan and allows the user to select that floorplan with a dropdown. The dropdown is shown conditionally on posts not defined as a floorplan. This dropdown appears to work correctly
I expected to see: When creating a View Filter for the field Floorplan Names Select, a dropdown list of the values that have been assigned to the posts. The database wp_postmeta table shows the values being stored as:
5159 812 wpcf-floor-plan-names-select Floorplan 2
Instead, I got: A blank drop down when adding a view filter:
The solution here rather depends on what the custom field is defined as.
If the floor-plan-names-select field is a select field then when you insert a filter control for this field the options will come from the values in the field settings (or values that you manually supply when inserting the filter). It is possible to overwrite this with a filter, but that's more complex than the alternative.
If the field is defined as a text field then when you insert the filter control you have the option to use a select dropdown with the option values coming from the postmeta data itself (see screenshot).
And that would be all you need to fix the empty select dropdown issue.
If it is a select field than that's expected, because the post meta values are not an option as the source of the select dropdown.
You need to use the wpt_field_options API hook to populate the select field with the options you require, using code similar to that which you use to generate the original dropdown used to create the post meta.