Inventory_Presser_Taxonomies::maybe_add_noindex( array $robots )
A URL like this works: example.com/inventory/make/honda/make/gmc/make/toyota/make/ford. Try to prevent tons of bot traffic to deep filtered inventory pages with a noindex meta tag.
On This Page
Parameters Parameters
- $robots
-
(array) (Required)
Return Return
(array)
Source Source
File: includes/class-taxonomies.php
public function maybe_add_noindex( $robots ) { // Is this a vehicle archive? if ( ! defined( 'INVP::POST_TYPE' ) || ! is_post_type_archive( INVP::POST_TYPE ) ) { // No. return $robots; } // How many taxonomy filters are in the query? $filter_count = 0; foreach ( self::query_vars_array() as $query_var ) { $vars = get_query_var( $query_var ); if ( '' !== $vars ) { if ( is_array( $vars ) ) { $filter_count += count( $vars ); } else { ++$filter_count; } // More than one? if ( $filter_count > 1 ) { $robots['noindex'] = $robots['nofollow'] = true; return $robots; } } } return $robots; }
Expand full source codeCollapse full source codeView on Github