Yoast\WP\SEO\Initializers
Crawl_Cleanup_Permalinks::clean_permalinks()
Removes unneeded query variables from the URL.
Метод класса: Crawl_Cleanup_Permalinks{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Crawl_Cleanup_Permalinks = new Crawl_Cleanup_Permalinks(); $Crawl_Cleanup_Permalinks->clean_permalinks();
Код Crawl_Cleanup_Permalinks::clean_permalinks() Crawl Cleanup Permalinks::clean permalinks Yoast 24.0
public function clean_permalinks() { if ( $this->crawl_cleanup_helper->should_avoid_redirect() ) { return; } $current_url = $this->url_helper->recreate_current_url(); $allowed_params = $this->crawl_cleanup_helper->allowed_params( $current_url ); // If we had only allowed params, let's just bail out, no further processing needed. if ( empty( $allowed_params['query'] ) ) { return; } $url_type = $this->crawl_cleanup_helper->get_url_type(); switch ( $url_type ) { case 'singular_url': $proper_url = $this->crawl_cleanup_helper->singular_url(); break; case 'front_page_url': $proper_url = $this->crawl_cleanup_helper->front_page_url(); break; case 'page_for_posts_url': $proper_url = $this->crawl_cleanup_helper->page_for_posts_url(); break; case 'taxonomy_url': $proper_url = $this->crawl_cleanup_helper->taxonomy_url(); break; case 'search_url': $proper_url = $this->crawl_cleanup_helper->search_url(); break; case 'page_not_found_url': $proper_url = $this->crawl_cleanup_helper->page_not_found_url( $current_url ); break; default: $proper_url = ''; } if ( $this->crawl_cleanup_helper->is_query_var_page( $proper_url ) ) { $proper_url = $this->crawl_cleanup_helper->query_var_page_url( $proper_url ); } $proper_url = \add_query_arg( $allowed_params['allowed_query'], $proper_url ); if ( empty( $proper_url ) || $current_url === $proper_url ) { return; } $this->crawl_cleanup_helper->do_clean_redirect( $proper_url ); }