aioseo_local_business_get_locations_by_category_args

Purpose

This filter can be used to change the locations by category query.

Arguments (2)

  1. $args (array) – WP_Query accepted arguments.
  2. $termId (int) – The queried term ID.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below the query arguments are changed to include ‘future’ locations on a specific category.

add_filter( 'aioseo_local_business_get_locations_by_category_args', 'aioseo_change_local_business_get_locations_by_category_args', 10, 2 );

function aioseo_change_local_business_get_locations_by_category_args( $args, $termId ) {
	if ( 14 === $termId ) {
		$args['post_status'] = [ 'publish', 'future' ];
	}

	return $args;
}