Completed
Pull Request — develop (#1336)
by Naveen
02:57
created

Entity_Taxonomy_No_Index::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 1
nop 0
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace Wordlift\Entity;
4
/**
5
 * @since 3.28.0
6
 * @author Naveen Muthusamy <[email protected]>
7
 */
8
9
/**
10
 * Filter to remove the entity taxonomy from sitemap.
11
 * Class Entity_Taxonomy_No_Index
12
 * @package Wordlift\Entity
13
 */
14
class Entity_Taxonomy_No_Index {
15
16
	public function __construct() {
17
18
		add_filter( 'wp_sitemaps_taxonomies', function ( $taxonomies ) {
19
			$entity_taxonomy = \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME;
20
			if ( array_key_exists( $entity_taxonomy, $taxonomies ) ) {
21
				unset( $taxonomies[ $entity_taxonomy ] );
22
			}
23
			return $taxonomies;
24
		} );
25
26
	}
27
28
}
29