| @@ -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 | /** |