PluginProbe
Polylang / trunk
Polylang vtrunk
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/modules/site-health/admin-site-health.php +15 -6 3.8.10 → trunk View file →
@@ -210,15 +210,24 @@
210 210 * @param array $tests Array with tests declaration data.
211 211 * @return array
212 212 */
213 213 public function status_tests( $tests ) {
214 - // Add the test only if the homepage displays static page.
215 - if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) ) {
216 - $tests['direct']['pll_homepage'] = array(
217 - 'label' => esc_html__( 'Homepage translated', 'polylang' ),
218 - 'test' => array( $this, 'homepage_test' ),
219 - );
214 + // Add the test only if the homepage is an existing static page.
215 + if ( 'page' !== get_option( 'show_on_front' ) ) {
216 + return $tests;
220 217 }
218 +
219 + $page_on_front = get_option( 'page_on_front' );
220 +
221 + if ( ! is_numeric( $page_on_front ) || ! get_post( (int) $page_on_front ) ) {
222 + return $tests;
223 + }
224 +
225 + $tests['direct']['pll_homepage'] = array(
226 + 'label' => esc_html__( 'Homepage translated', 'polylang' ),
227 + 'test' => array( $this, 'homepage_test' ),
228 + );
229 +
221 230 return $tests;
222 231 }
223 232
224 233 /**