WP Rentals Help WP Rentals Help

  • 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

5329 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 Disable WordPress Image Compression and Preserve Original Quality
  • How to Change the Default Categories Icon from Listing Card Unit
  • How to change the background color and logo for admin login page
  • How to redirect Instant Booking Button to WooComemrce Checkout Page

HELP CATEGORIES

  • 71. General
  • 102. Installation & Basic Setup
  • 393. How Booking Works
  • 20Advanced Search
  • 19Elementor Free & WP Rentals Studio
  • 13Email Notifications
  • 10FAQ
  • 14Installation FAQ
  • 10Menu Options
  • 27Multi-Languages - 3rd party
  • 32Owner & Renter
  • 9Page Templates
  • 24Property / Listing
  • 21Shortcodes
  • 4Supported Maps
  • 97Technical how to
  • 5Third Party plugins
  • 3Translation
  • 3WordPress Blog Post
  • 13WordPress Widgets
  • 12WP Rentals Payments
  • 78WP Rentals Theme Options

Join Us On

Powered by WP Estate - All Rights Reserved
  • Client Support
  • Video Tutorials
  • WpRentals
  • WpEstate
  • API