aioseo_local_business_get_location_categories

Purpose

This filter can be used to change the location’s category results.

Arguments (1)

  1. $categories (array) – An array of WP_Term.
  2. $args (array) – WP_Term_Query arguments.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we exclude a category from the results.

add_filter( 'aioseo_local_business_get_location_categories', 'aioseo_change_local_business_get_location_categories', 10, 2 );

function aioseo_change_local_business_get_location_categories( $categories, $args ) {
	foreach ( $categories as $key => $category ) {
		if ( 14 === $category->term_id ) {
			unset( $categories[ $key ] );
		}
	}

	return $categories;
}