term_id : null; case 'term_slug': $term = self::current_term(); return $term ? (string) $term->slug : null; case 'term_taxonomy': $term = self::current_term(); return $term ? (string) $term->taxonomy : null; case 'search_query': if ( function_exists( 'is_search' ) && is_search() ) { $q = function_exists( 'get_search_query' ) ? get_search_query() : ''; return '' !== $q ? sanitize_text_field( $q ) : null; } return null; case 'archive_post_type': if ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) { return (string) get_post_type(); } return null; } return null; } private static function classify_page_type() { if ( function_exists( 'is_singular' ) && is_singular() ) { return 'singular'; } if ( function_exists( 'is_category' ) && is_category() ) { return 'category'; } if ( function_exists( 'is_tag' ) && is_tag() ) { return 'tag'; } if ( function_exists( 'is_tax' ) && is_tax() ) { return 'tax'; } if ( function_exists( 'is_author' ) && is_author() ) { return 'author'; } if ( function_exists( 'is_date' ) && is_date() ) { return 'date'; } if ( function_exists( 'is_search' ) && is_search() ) { return 'search'; } if ( function_exists( 'is_404' ) && is_404() ) { return '404'; } if ( function_exists( 'is_front_page' ) && is_front_page() ) { return 'home'; } if ( function_exists( 'is_home' ) && is_home() ) { return 'home'; } if ( function_exists( 'is_archive' ) && is_archive() ) { return 'archive'; } return null; } private static function current_term() { if ( ! ( ( function_exists( 'is_category' ) && is_category() ) || ( function_exists( 'is_tag' ) && is_tag() ) || ( function_exists( 'is_tax' ) && is_tax() ) ) ) { return null; } $obj = get_queried_object(); if ( ! $obj || empty( $obj->term_id ) ) { return null; } return $obj; } } }