WPRentals Theme Documentation WPRentals Theme Documentation

  • Client Support
  • Video Tutorials
  • WPRentals
  • WPEstate
  • API
Home / Technical how to / How to remove countries from the dropdown

How to remove countries from the dropdown

6091 views

Modify the list of countries shown in the dropdown

Locate the country list
Open libs/help_functions.php and find the function wprentals_return_country_array().
It returns the full list of countries used throughout the theme:

if (!function_exists('wprentals_return_country_array')):
function wprentals_return_country_array() {
$countries = array(
'Afghanistan' => esc_html__('Afghanistan', 'wprentals'),
'Albania' => esc_html__('Albania', 'wprentals'),
'Algeria' => esc_html__('Algeria', 'wprentals'),
// ...
);
// return $countries;
}
endif;
}​

Remove, add, or edit entries

Remove a country: delete its line from the $countries array.

Add a country: insert a new line with 'Country Name' => esc_html__('Country Name', 'wprentals'),.

Rename a country: change both the array key and its translated label.

Optional – override in a child theme
Because the function is wrapped in if (!function_exists(...)), you can copy it into a child theme’s functions.php and customize the array there. This keeps changes safe from theme updates.

Where the list is used
The dropdowns are populated by wpestate_country_list_search(), which pulls the array above and builds the options:

if( !function_exists('wpestate_country_list_search') ):
function wpestate_country_list_search($selected) {
    $countries = wpestate_return_country_list_translated();
    $country_select_list = '';
    foreach ($countries as $country) {
        $country_select_list .= '<li role="presentation" data-value="' . esc_attr($country) . '">' . $country . '</li>';
    }
}
endif;

Updating wprentals_return_country_array() will automatically reflect in all dropdowns generated through this search helper.

Technical how to

Related Articles

  • How to Make a Contact Button Open WhatsApp
  • How to add a new currency in Theme Options for payments.
  • How to Disable WordPress Image Compression and Preserve Original Quality
  • How to Change the Default Categories Icon from Listing Card Unit

HELP CATEGORIES

  • 61. General
  • 72. Installation & Basic Setup
  • 373. How Booking Works
  • 18Advanced Search
  • 17Elementor WPRentals Studio
  • 14Email Notifications
  • 23FAQ
  • 14Installation FAQ
  • 10Menu Options
  • 34Owner & Renter
  • 8Page Templates
  • 23Property / Listing
  • 22Shortcodes
  • 4Supported Maps
  • 98Technical how to
  • 5Third Party plugins
  • 4Translation & Multi Languages
  • 3WordPress Blog Post
  • 13WordPress Widgets
  • 12WP Rentals Payments
  • 79WP Rentals Theme Options
  • 26WPML & Weglot

Join Us On

Powered by WP Estate - All Rights Reserved
  • Client Support
  • Video Tutorials
  • WPRentals
  • WPEstate
  • API