PluginProbe
Polylang / 3.8.10
Polylang v3.8.10
3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 All 234 releases
← All changes | src/frontend/frontend-static-pages.php +3 -24 3.8.8 → 3.8.10 View file →
@@ -130,38 +130,17 @@
130 130 return $url;
131 131 }
132 132
133 133 /**
134 - * Manages redirections for the static front pages.
134 + * Prevents the canonical redirect if we are on a static front page.
135 135 *
136 136 * @since 1.8
137 137 *
138 - * @param string|false $redirect_url The redirect URL.
138 + * @param string $redirect_url The redirect url.
139 139 * @return string|false
140 140 */
141 141 public function pll_check_canonical_url( $redirect_url ) {
142 - global $wp_query;
143 -
144 - if ( empty( $this->curlang->page_on_front ) ) {
145 - return $redirect_url;
146 - }
147 -
148 - if ( $this->options['redirect_lang'] ) {
149 - // Prevent the canonical redirect if we are on a static front page.
150 - if ( empty( $redirect_url ) ) {
151 - // Already prevented.
152 - return $redirect_url;
153 - }
154 - return ! $this->options['force_lang'] && $wp_query->is_page( $this->curlang->page_on_front ) ? false : $redirect_url;
155 - }
156 -
157 - if ( 1 === $this->options['force_lang'] && ! $this->options['hide_default'] && $wp_query->is_home && ! $wp_query->is_posts_page ) {
158 - // Redirect example.com/fr/ to example.com/fr/front-page/ if we're not hiding the page name, and not hiding
159 - // the language slug for the default language.
160 - return $this->curlang->get_home_url();
161 - }
162 -
163 - return $redirect_url;
142 + return $this->options['redirect_lang'] && ! $this->options['force_lang'] && ! empty( $this->curlang->page_on_front ) && is_page( $this->curlang->page_on_front ) ? false : $redirect_url;
164 143 }
165 144
166 145 /**
167 146 * Is the query for a the static front page (redirected from the language page)?