If you’re using the famous Events Manager plugin and you want to remove or add the default countries in the drop down menu without modifying the core file (em-functions.php) you can simply add a filter in your functions.php inside your WordPress theme file. Below is a very short code that I made and you can simply modify it without my permission.
function customcountries(){
$em_countries_custom['US'] = 'United States';
$em_countries_custom['PH'] = 'Philippines';
unset($em_countries_array);
return $em_countries_new;
}
add_filter('em_get_countries','customcountries');
Just add the code above in your functions.php file, and it will work. This will replace your very long countries dropdown to just United States and Philippines.
I’m a PHP noob, so I don’t know if the unset variable is appropriate to use in this function or not. But it did the trick, so I’m using it. All I did is removed the default countries by using unset and just returned the custom countries that I added.
After adding the code, the Countries dropdown in your Submit Events form will look like this:
It works like magic! Try it out!