Function Reference: geodir_remove_location_terms

Summary

Remove the location terms to hide term from location url.

Package

GeoDirectory

Parameters

$location_terms
(array) (required) Array of location terms.

Default: None

Return Values

(array)
  • Location terms.

Change Log

Since: 1.5.5

Filters

‘geodir_remove_location_terms’ [Line: 5038]

Source File

geodir_remove_location_terms() is located in geodirectory-functions/general_functions.php [Line: 5007]

Source Code

function geodir_remove_location_terms( $location_terms = array() ) {
	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;

	if ( ! empty( $location_terms ) && $location_manager ) {
		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );

		if ( $hide_region_part && $hide_country_part ) {
			if ( isset( $location_terms['gd_country'] ) ) {
				unset( $location_terms['gd_country'] );
			}
			if ( isset( $location_terms['gd_region'] ) ) {
				unset( $location_terms['gd_region'] );
			}
		} else if ( $hide_region_part && ! $hide_country_part ) {
			if ( isset( $location_terms['gd_region'] ) ) {
				unset( $location_terms['gd_region'] );
			}
		} else if ( ! $hide_region_part && $hide_country_part ) {
			if ( isset( $location_terms['gd_country'] ) ) {
				unset( $location_terms['gd_country'] );
			}
		}
	}

	/**
	 * Filter the remove location terms array.
	 * 
	 * @since 1.6.22
	 * @param array $location_terms The array of location terms.
	 */
	return apply_filters('geodir_remove_location_terms',$location_terms);
}