urls->pretty() || ! $this->settings->get()->is_translatable_type( 'page' ) ) { return $link; } $post_id = (int) $post_id; $lang = $this->posts->language_of( $post_id ); if ( $this->is_front_group( $post_id ) && 'publish' === get_post_status( $post_id ) ) { return $this->urls->lang_home( $lang ); } return $this->urls->add_prefix( $link, $lang ); } public function post_link( mixed $link, mixed $post ): mixed { $post = get_post( $post ); if ( ! is_string( $link ) || ! $post || ! $this->urls->pretty() || ! $this->settings->get()->is_translatable_type( $post->post_type ) ) { return $link; } return $this->urls->add_prefix( $link, $this->posts->language_of( $post->ID ) ); } /** Is the page the static front page in any language? */ public function is_front_group( int $post_id ): bool { if ( 'page' !== get_option( 'show_on_front' ) ) { return false; } $front = $this->urls->raw_option( 'page_on_front' ); return $front && in_array( $post_id, $this->posts->group( $front ), true ); } }