Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Purpose
This filter can be used to change the locations found on a category before the output.
Arguments (1)
- $locations (array) – An array of WP_Post
- $instance (array) – An array of options.
- $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;
}