This filter modifies the end result coming from our API.
NOTE: Modifying this filter affects the functionality of the entire plugin.
function example_callback( $api_response, $default_api_fileds = array() ) { // Maybe modify $api_response in some way. return $api_response; } add_filter( 'cf_geoplugin_api_response', 'example_callback', 1, 2 );
EXAMPLE:
If you want to change the name of a country by your local name, you can do so through this filter:
if(!function_exists('change_cf_geoplugin_translations')) { function change_cf_geoplugin_translations( $response ) { // Translate switch($response['country_code']) { case 'FR': $response['country'] = 'Français'; break; case 'RS': $response['country'] = 'Srbija'; break; case 'CN': $response['country'] = '中國'; break; } /* Do any other filter you want */ return $response; } } add_filter( 'cf_geoplugin_api_response', 'change_cf_geoplugin_translations', 1 );