Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wordpres.../src/helpers
File: current-page-helper.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Helpers;
[2] Fix | Delete
[3] Fix | Delete
use WP_Post;
[4] Fix | Delete
use Yoast\WP\SEO\Wrappers\WP_Query_Wrapper;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* A helper object for WordPress posts.
[8] Fix | Delete
*/
[9] Fix | Delete
class Current_Page_Helper {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The WP Query wrapper.
[13] Fix | Delete
*
[14] Fix | Delete
* @var WP_Query_Wrapper
[15] Fix | Delete
*/
[16] Fix | Delete
private $wp_query_wrapper;
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Current_Page_Helper constructor.
[20] Fix | Delete
*
[21] Fix | Delete
* @codeCoverageIgnore It only sets dependencies.
[22] Fix | Delete
*
[23] Fix | Delete
* @param WP_Query_Wrapper $wp_query_wrapper The wrapper for WP_Query.
[24] Fix | Delete
*/
[25] Fix | Delete
public function __construct(
[26] Fix | Delete
WP_Query_Wrapper $wp_query_wrapper
[27] Fix | Delete
) {
[28] Fix | Delete
$this->wp_query_wrapper = $wp_query_wrapper;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Returns the page type for the current request.
[33] Fix | Delete
*
[34] Fix | Delete
* @codeCoverageIgnore It just depends on other functions for its result.
[35] Fix | Delete
*
[36] Fix | Delete
* @return string Page type.
[37] Fix | Delete
*/
[38] Fix | Delete
public function get_page_type() {
[39] Fix | Delete
switch ( true ) {
[40] Fix | Delete
case $this->is_search_result():
[41] Fix | Delete
return 'Search_Result_Page';
[42] Fix | Delete
case $this->is_static_posts_page():
[43] Fix | Delete
return 'Static_Posts_Page';
[44] Fix | Delete
case $this->is_home_static_page():
[45] Fix | Delete
return 'Static_Home_Page';
[46] Fix | Delete
case $this->is_home_posts_page():
[47] Fix | Delete
return 'Home_Page';
[48] Fix | Delete
case $this->is_simple_page():
[49] Fix | Delete
return 'Post_Type';
[50] Fix | Delete
case $this->is_post_type_archive():
[51] Fix | Delete
return 'Post_Type_Archive';
[52] Fix | Delete
case $this->is_term_archive():
[53] Fix | Delete
return 'Term_Archive';
[54] Fix | Delete
case $this->is_author_archive():
[55] Fix | Delete
return 'Author_Archive';
[56] Fix | Delete
case $this->is_date_archive():
[57] Fix | Delete
return 'Date_Archive';
[58] Fix | Delete
case $this->is_404():
[59] Fix | Delete
return 'Error_Page';
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
return 'Fallback';
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Checks if the currently opened page is a simple page.
[67] Fix | Delete
*
[68] Fix | Delete
* @return bool Whether the currently opened page is a simple page.
[69] Fix | Delete
*/
[70] Fix | Delete
public function is_simple_page() {
[71] Fix | Delete
return $this->get_simple_page_id() > 0;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
/**
[75] Fix | Delete
* Returns the id of the currently opened page.
[76] Fix | Delete
*
[77] Fix | Delete
* @return int The id of the currently opened page.
[78] Fix | Delete
*/
[79] Fix | Delete
public function get_simple_page_id() {
[80] Fix | Delete
if ( \is_singular() ) {
[81] Fix | Delete
return \get_the_ID();
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
if ( $this->is_posts_page() ) {
[85] Fix | Delete
return \get_option( 'page_for_posts' );
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Filter: Allow changing the default page id.
[90] Fix | Delete
*
[91] Fix | Delete
* @param int $page_id The default page id.
[92] Fix | Delete
*/
[93] Fix | Delete
return \apply_filters( 'wpseo_frontend_page_type_simple_page_id', 0 );
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* Returns the id of the currently opened author archive.
[98] Fix | Delete
*
[99] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[100] Fix | Delete
*
[101] Fix | Delete
* @return int The id of the currently opened author archive.
[102] Fix | Delete
*/
[103] Fix | Delete
public function get_author_id() {
[104] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[105] Fix | Delete
[106] Fix | Delete
return $wp_query->get( 'author' );
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Returns the id of the front page.
[111] Fix | Delete
*
[112] Fix | Delete
* @return int The id of the front page. 0 if the front page is not a static page.
[113] Fix | Delete
*/
[114] Fix | Delete
public function get_front_page_id() {
[115] Fix | Delete
if ( \get_option( 'show_on_front' ) !== 'page' ) {
[116] Fix | Delete
return 0;
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
return (int) \get_option( 'page_on_front' );
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
/**
[123] Fix | Delete
* Returns the id of the currently opened term archive.
[124] Fix | Delete
*
[125] Fix | Delete
* @return int The id of the currently opened term archive.
[126] Fix | Delete
*/
[127] Fix | Delete
public function get_term_id() {
[128] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[129] Fix | Delete
[130] Fix | Delete
if ( $wp_query->is_tax() || $wp_query->is_tag() || $wp_query->is_category() ) {
[131] Fix | Delete
$queried_object = $wp_query->get_queried_object();
[132] Fix | Delete
if ( $queried_object && ! \is_wp_error( $queried_object ) ) {
[133] Fix | Delete
return $queried_object->term_id;
[134] Fix | Delete
}
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
return 0;
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
/**
[141] Fix | Delete
* Returns the post type of the main query.
[142] Fix | Delete
*
[143] Fix | Delete
* @return string The post type of the main query.
[144] Fix | Delete
*/
[145] Fix | Delete
public function get_queried_post_type() {
[146] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[147] Fix | Delete
$post_type = $wp_query->get( 'post_type' );
[148] Fix | Delete
if ( \is_array( $post_type ) ) {
[149] Fix | Delete
$post_type = \reset( $post_type );
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
return $post_type;
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
/**
[156] Fix | Delete
* Returns the permalink of the currently opened date archive.
[157] Fix | Delete
* If the permalink was cached, it returns this permalink.
[158] Fix | Delete
* If not, we call another function to get the permalink through wp_query.
[159] Fix | Delete
*
[160] Fix | Delete
* @return string The permalink of the currently opened date archive.
[161] Fix | Delete
*/
[162] Fix | Delete
public function get_date_archive_permalink() {
[163] Fix | Delete
static $date_archive_permalink;
[164] Fix | Delete
[165] Fix | Delete
if ( isset( $date_archive_permalink ) ) {
[166] Fix | Delete
return $date_archive_permalink;
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
$date_archive_permalink = $this->get_non_cached_date_archive_permalink();
[170] Fix | Delete
[171] Fix | Delete
return $date_archive_permalink;
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
/**
[175] Fix | Delete
* Determine whether this is the homepage and shows posts.
[176] Fix | Delete
*
[177] Fix | Delete
* @return bool Whether or not the current page is the homepage that displays posts.
[178] Fix | Delete
*/
[179] Fix | Delete
public function is_home_posts_page() {
[180] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[181] Fix | Delete
[182] Fix | Delete
if ( ! $wp_query->is_home() ) {
[183] Fix | Delete
return false;
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
/*
[187] Fix | Delete
* Whether the static page's `Homepage` option is actually not set to a page.
[188] Fix | Delete
* Otherwise WordPress proceeds to handle the homepage as a `Your latest posts` page.
[189] Fix | Delete
*/
[190] Fix | Delete
if ( (int) \get_option( 'page_on_front' ) === 0 ) {
[191] Fix | Delete
return true;
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
return \get_option( 'show_on_front' ) === 'posts';
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
/**
[198] Fix | Delete
* Determine whether this is the static frontpage.
[199] Fix | Delete
*
[200] Fix | Delete
* @return bool Whether or not the current page is a static frontpage.
[201] Fix | Delete
*/
[202] Fix | Delete
public function is_home_static_page() {
[203] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[204] Fix | Delete
[205] Fix | Delete
if ( ! $wp_query->is_front_page() ) {
[206] Fix | Delete
return false;
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
if ( \get_option( 'show_on_front' ) !== 'page' ) {
[210] Fix | Delete
return false;
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
return $wp_query->is_page( \get_option( 'page_on_front' ) );
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
/**
[217] Fix | Delete
* Determine whether this is the static posts page.
[218] Fix | Delete
*
[219] Fix | Delete
* @return bool Whether or not the current page is a static posts page.
[220] Fix | Delete
*/
[221] Fix | Delete
public function is_static_posts_page() {
[222] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[223] Fix | Delete
$queried_object = $wp_query->get_queried_object();
[224] Fix | Delete
[225] Fix | Delete
return (
[226] Fix | Delete
$wp_query->is_posts_page
[227] Fix | Delete
&& \is_a( $queried_object, WP_Post::class )
[228] Fix | Delete
&& $queried_object->post_type === 'page'
[229] Fix | Delete
);
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
/**
[233] Fix | Delete
* Determine whether this is the statically set posts page, when it's not the frontpage.
[234] Fix | Delete
*
[235] Fix | Delete
* @return bool Whether or not it's a non-frontpage, statically set posts page.
[236] Fix | Delete
*/
[237] Fix | Delete
public function is_posts_page() {
[238] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[239] Fix | Delete
[240] Fix | Delete
if ( ! $wp_query->is_home() ) {
[241] Fix | Delete
return false;
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
return \get_option( 'show_on_front' ) === 'page';
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
/**
[248] Fix | Delete
* Determine whether this is a post type archive.
[249] Fix | Delete
*
[250] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[251] Fix | Delete
*
[252] Fix | Delete
* @return bool Whether nor not the current page is a post type archive.
[253] Fix | Delete
*/
[254] Fix | Delete
public function is_post_type_archive() {
[255] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[256] Fix | Delete
[257] Fix | Delete
return $wp_query->is_post_type_archive();
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
/**
[261] Fix | Delete
* Determine whether this is a term archive.
[262] Fix | Delete
*
[263] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[264] Fix | Delete
*
[265] Fix | Delete
* @return bool Whether nor not the current page is a term archive.
[266] Fix | Delete
*/
[267] Fix | Delete
public function is_term_archive() {
[268] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[269] Fix | Delete
[270] Fix | Delete
return $wp_query->is_tax || $wp_query->is_tag || $wp_query->is_category;
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
/**
[274] Fix | Delete
* Determine whether this is an attachment page.
[275] Fix | Delete
*
[276] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[277] Fix | Delete
*
[278] Fix | Delete
* @return bool Whether nor not the current page is an attachment page.
[279] Fix | Delete
*/
[280] Fix | Delete
public function is_attachment() {
[281] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[282] Fix | Delete
[283] Fix | Delete
return $wp_query->is_attachment;
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
/**
[287] Fix | Delete
* Determine whether this is an author archive.
[288] Fix | Delete
*
[289] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[290] Fix | Delete
*
[291] Fix | Delete
* @return bool Whether nor not the current page is an author archive.
[292] Fix | Delete
*/
[293] Fix | Delete
public function is_author_archive() {
[294] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[295] Fix | Delete
[296] Fix | Delete
return $wp_query->is_author();
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Determine whether this is an date archive.
[301] Fix | Delete
*
[302] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[303] Fix | Delete
*
[304] Fix | Delete
* @return bool Whether nor not the current page is an date archive.
[305] Fix | Delete
*/
[306] Fix | Delete
public function is_date_archive() {
[307] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[308] Fix | Delete
[309] Fix | Delete
return $wp_query->is_date();
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
/**
[313] Fix | Delete
* Determine whether this is a search result.
[314] Fix | Delete
*
[315] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[316] Fix | Delete
*
[317] Fix | Delete
* @return bool Whether nor not the current page is a search result.
[318] Fix | Delete
*/
[319] Fix | Delete
public function is_search_result() {
[320] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[321] Fix | Delete
[322] Fix | Delete
return $wp_query->is_search();
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
/**
[326] Fix | Delete
* Determine whether this is a 404 page.
[327] Fix | Delete
*
[328] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[329] Fix | Delete
*
[330] Fix | Delete
* @return bool Whether nor not the current page is a 404 page.
[331] Fix | Delete
*/
[332] Fix | Delete
public function is_404() {
[333] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[334] Fix | Delete
[335] Fix | Delete
return $wp_query->is_404();
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
/**
[339] Fix | Delete
* Checks if the current page is the post format archive.
[340] Fix | Delete
*
[341] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[342] Fix | Delete
*
[343] Fix | Delete
* @return bool Whether or not the current page is the post format archive.
[344] Fix | Delete
*/
[345] Fix | Delete
public function is_post_format_archive() {
[346] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[347] Fix | Delete
[348] Fix | Delete
return $wp_query->is_tax( 'post_format' );
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
/**
[352] Fix | Delete
* Determine whether this page is an taxonomy archive page for multiple terms (url: /term-1,term2/).
[353] Fix | Delete
*
[354] Fix | Delete
* @return bool Whether or not the current page is an archive page for multiple terms.
[355] Fix | Delete
*/
[356] Fix | Delete
public function is_multiple_terms_page() {
[357] Fix | Delete
if ( ! $this->is_term_archive() ) {
[358] Fix | Delete
return false;
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
return $this->count_queried_terms() > 1;
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
/**
[365] Fix | Delete
* Checks whether the current page is paged.
[366] Fix | Delete
*
[367] Fix | Delete
* @codeCoverageIgnore This method only calls a WordPress function.
[368] Fix | Delete
*
[369] Fix | Delete
* @return bool Whether the current page is paged.
[370] Fix | Delete
*/
[371] Fix | Delete
public function is_paged() {
[372] Fix | Delete
return \is_paged();
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
/**
[376] Fix | Delete
* Checks if the current page is the front page.
[377] Fix | Delete
*
[378] Fix | Delete
* @codeCoverageIgnore It wraps WordPress functionality.
[379] Fix | Delete
*
[380] Fix | Delete
* @return bool Whether or not the current page is the front page.
[381] Fix | Delete
*/
[382] Fix | Delete
public function is_front_page() {
[383] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[384] Fix | Delete
[385] Fix | Delete
return $wp_query->is_front_page();
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
/**
[389] Fix | Delete
* Retrieves the current admin page.
[390] Fix | Delete
*
[391] Fix | Delete
* @codeCoverageIgnore It only wraps a global WordPress variable.
[392] Fix | Delete
*
[393] Fix | Delete
* @return string The current page.
[394] Fix | Delete
*/
[395] Fix | Delete
public function get_current_admin_page() {
[396] Fix | Delete
global $pagenow;
[397] Fix | Delete
[398] Fix | Delete
return $pagenow;
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
/**
[402] Fix | Delete
* Check if the current opened page is a Yoast SEO page.
[403] Fix | Delete
*
[404] Fix | Delete
* @return bool True when current page is a yoast seo plugin page.
[405] Fix | Delete
*/
[406] Fix | Delete
public function is_yoast_seo_page() {
[407] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[408] Fix | Delete
if ( isset( $_GET['page'] ) && \is_string( $_GET['page'] ) ) {
[409] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only using the variable in the strpos function.
[410] Fix | Delete
$current_page = \wp_unslash( $_GET['page'] );
[411] Fix | Delete
return \strpos( $current_page, 'wpseo_' ) === 0;
[412] Fix | Delete
}
[413] Fix | Delete
return false;
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
/**
[417] Fix | Delete
* Returns the current Yoast SEO page.
[418] Fix | Delete
* (E.g. the `page` query variable in the URL).
[419] Fix | Delete
*
[420] Fix | Delete
* @return string The current Yoast SEO page.
[421] Fix | Delete
*/
[422] Fix | Delete
public function get_current_yoast_seo_page() {
[423] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[424] Fix | Delete
if ( isset( $_GET['page'] ) && \is_string( $_GET['page'] ) ) {
[425] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
[426] Fix | Delete
return \sanitize_text_field( \wp_unslash( $_GET['page'] ) );
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
return '';
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
/**
[433] Fix | Delete
* Checks if the current global post is the privacy policy page.
[434] Fix | Delete
*
[435] Fix | Delete
* @return bool current global post is set as privacy page
[436] Fix | Delete
*/
[437] Fix | Delete
public function current_post_is_privacy_policy() {
[438] Fix | Delete
global $post;
[439] Fix | Delete
[440] Fix | Delete
if ( ! isset( $post->ID ) ) {
[441] Fix | Delete
return false;
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
return \intval( $post->ID ) === \intval( \get_option( 'wp_page_for_privacy_policy', false ) );
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
/**
[448] Fix | Delete
* Returns the permalink of the currently opened date archive.
[449] Fix | Delete
*
[450] Fix | Delete
* @return string The permalink of the currently opened date archive.
[451] Fix | Delete
*/
[452] Fix | Delete
protected function get_non_cached_date_archive_permalink() {
[453] Fix | Delete
$date_archive_permalink = '';
[454] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[455] Fix | Delete
[456] Fix | Delete
if ( $wp_query->is_day() ) {
[457] Fix | Delete
$date_archive_permalink = \get_day_link( $wp_query->get( 'year' ), $wp_query->get( 'monthnum' ), $wp_query->get( 'day' ) );
[458] Fix | Delete
}
[459] Fix | Delete
if ( $wp_query->is_month() ) {
[460] Fix | Delete
$date_archive_permalink = \get_month_link( $wp_query->get( 'year' ), $wp_query->get( 'monthnum' ) );
[461] Fix | Delete
}
[462] Fix | Delete
if ( $wp_query->is_year() ) {
[463] Fix | Delete
$date_archive_permalink = \get_year_link( $wp_query->get( 'year' ) );
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
return $date_archive_permalink;
[467] Fix | Delete
}
[468] Fix | Delete
[469] Fix | Delete
/**
[470] Fix | Delete
* Counts the total amount of queried terms.
[471] Fix | Delete
*
[472] Fix | Delete
* @codeCoverageIgnore This relies too much on WordPress dependencies.
[473] Fix | Delete
*
[474] Fix | Delete
* @return int The amoumt of queried terms.
[475] Fix | Delete
*/
[476] Fix | Delete
protected function count_queried_terms() {
[477] Fix | Delete
$wp_query = $this->wp_query_wrapper->get_main_query();
[478] Fix | Delete
$term = $wp_query->get_queried_object();
[479] Fix | Delete
[480] Fix | Delete
$queried_terms = $wp_query->tax_query->queried_terms;
[481] Fix | Delete
if ( \is_null( $term ) || empty( $queried_terms[ $term->taxonomy ]['terms'] ) ) {
[482] Fix | Delete
return 0;
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
return \count( $queried_terms[ $term->taxonomy ]['terms'] );
[486] Fix | Delete
}
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function