| @@ -198,9 +198,14 @@ | ||
| 198 | 198 | * @since 10.1.55 |
| 199 | 199 | */ |
| 200 | 200 | $wpml_post_lang = apply_filters('wpml_post_language_details', null, $post_id); |
| 201 | 201 | |
| 202 | - if ($wpml_post_lang) | |
| 202 | + /** | |
| 203 | + * Make sure we haven't received an error object from WPML. | |
| 204 | + * | |
| 205 | + * @since 10.1.60 | |
| 206 | + */ | |
| 207 | + if ($wpml_post_lang && !is_wp_error($wpml_post_lang)) | |
| 203 | 208 | { |
| 204 | 209 | // WPML supported, go ahead |
| 205 | 210 | return apply_filters('wpml_permalink', get_permalink($post_id), $wpml_post_lang['language_code']); |
| 206 | 211 | } |