aioseo_local_business_output_location_category_location_data

Purpose

This filter can be used to change the locations found on a category before the output.

Arguments (1)

  1. $locations (array) – An array of WP_Post
  2. $instance (array) – An array of options.
  3. $termId (int) – The location category ID being rendered.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll remove locations with a ‘future’ status.

add_filter( 'aioseo_local_business_output_location_category_location_data', 'aioseo_change_local_business_output_location_category_location_data', 10, 3 );

function aioseo_change_local_business_output_location_category_location_data( $locations, $instance, $termId ) {
	foreach ( $locations as $key => $location ) {
		if ( 'future' === $location->post_status ) {
			unset( $locations[ $key ] );
		}
	}

	return $locations;
}