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

5240 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 change the background color and logo for admin login page
  • How to redirect Instant Booking Button to WooComemrce Checkout Page
  • Tehnical: Redirect to Page Not found/ White screen on listing submission or edit
  • Technical – Invoices from My Bookings

HELP CATEGORIES

  • 61. General
  • 102. Installation & Basic Setup
  • 93. Installation FAQ
  • 404. How Booking Works
  • 145. User dashboard pages
  • 20Advanced Search Options
  • 3Blog Post
  • 9Custom Page Templates
  • 18Elementor Compatibility
  • 13Email Notifications
  • 19FAQ
  • 10Menu Options
  • 26Multi-Languages - 3rd party
  • 9Owner
  • 25Property / Listing
  • 21Shortcodes
  • 11Submit Form
  • 4Supported Maps
  • 93Technical how to
  • 5Third Party plugins
  • 3Translation
  • 13Widgets
  • 2WooCommerce Payments
  • 13WP Rentals Payment
  • 77WP Rentals Theme Options

Join Us On

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