Plugin Contributor
Paolo
(@paoltaia)
Hi,
if you need a field with only 4 countries, it would be a lot easier to create a custom field with only those 4 countries in it, than removing those you don’t need from the actual country custom fields.
Thanks,
You can use following code snippet in a snippet plugin to show only limited countries. Change the countries as per your requirements.
add_filter(‘uwp_country_list’, ‘uwp_country_list_cb’, 10, 1);
function uwp_country_list_cb(){
$countries = array(
‘us’ => ‘United States’,
‘ca’ => ‘Canada’,
‘mx’ => ‘Mexico (México)’,
);
return $countries;
}
Good day
Thank you very much for the answers.
@paolo that’s not what I wanted to do, because I like the list because the countries also show a flag in the selection.
can you still tell me where I can find the list of countries?
@alexrollin in which file would I have to write this where?
I’m not that expert and I don’t want to break anything.
You need to add that code in the functions.php file of the currently active theme or by installing Code Snippets plugin from the backend. You can see the list of countries here: https://github.com/AyeCode/userswp/blob/3d209e391a8f56d7df2077282c7c8d90c3011fd2/includes/class-countries.php#L18