aioseo_public_taxonomies

Purpose & version added

This filter can be used to manage the public taxonomies.

Arguments (1)

  1. $taxonomies (array) – A list of roles being ignored.
  2. $namesOnly (bool) – Whether only the names should be returned.

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 the genre taxonomy from the public taxonomies list.

// Removes the genre taxonomy from the public taxonomies list.
add_filter( 'aioseo_public_taxonomies', 'aioseo_filter_public_taxonomies' );
function aioseo_filter_public_taxonomies( $taxonomies ) {
	$filteredTaxonomies = [];
	foreach ( $taxonomies as $taxonomiesObject ) {
		if ( 'genre' === $taxonomiesObject['name'] ) {
			continue;
		}
		$filteredTaxonomies[] = $taxonomiesObject;
	}

	return $filteredTaxonomies;
}

Changelog

VersionDescription
4.1.6Introduced.