Ultimate Member callback function issue

I am trying to filter child drop-down inputs based on parent dropdown. For example, if I select a state I need to show the cities only in the selected state.
What I have done so far is added this below function in the functions.php file.

function getCities() {
//get the value from the ‘parent’ field, sent via the AJAX post.
$choice = $_POST[‘choose_mavatam1’];

switch($choice) {
case “Tamilnadu”:
$cities = [
“Chennai” =>”Chennai”,

case “Karnataka”:
$cities = [

//code to do something if other options are not selected (throw an error, or set $cities to a default array)
$cities = [“no city”];

return $cities;

I called this below function in Choices Callback field of ultimate member plugin for the parent field. The bug I face is the Edit Choices becomes this switch case’s default value automatically as no city when I used this callback function.

Read more here:: Ultimate Member callback function issue

Leave a Reply

Your email address will not be published. Required fields are marked *