@@ -283,23 +283,32 @@ public function getPostTypeLink(string $postLink, WP_Post $wpPost): string
283
283
return trailingslashit ($ postLink );
284
284
}
285
285
286
- public function getPostTypeArchiveLink (string $ link , string $ post_type ): string
286
+ public function getPostTypeArchiveLink (string $ link , string $ postType ): string
287
287
{
288
288
$ optionsReadingPostTypes = OptionsReadingPostTypes::getInstance ()->getOptions ();
289
289
290
290
if ($ optionsReadingPostTypes === [] || $ optionsReadingPostTypes === false ) {
291
291
return trailingslashit ($ link );
292
292
}
293
293
294
- $ pageForArchiveId = $ optionsReadingPostTypes [$ post_type ] ?? null ;
294
+ $ pageForArchiveId = $ optionsReadingPostTypes [$ postType ] ?? null ;
295
+
296
+ if ($ pageForArchiveId === null ) {
297
+ return trailingslashit ($ link );
298
+ }
299
+
295
300
$ currentLanguage = apply_filters ('wpml_current_language ' , null );
296
301
297
- if ($ optionsReadingPostTypes === [] || $ optionsReadingPostTypes === false || empty ( $ currentLanguage ) || empty ($ currentLanguage )) {
302
+ if (empty ($ currentLanguage )) {
298
303
return trailingslashit ($ link );
299
304
}
300
305
301
306
$ pageForArchiveUri = $ this ->getPageForArchiveUri ($ pageForArchiveId , $ currentLanguage );
302
- return trailingslashit (home_url ($ pageForArchiveUri )) ?: trailingslashit ($ link );
307
+ if ($ pageForArchiveUri === '' ) {
308
+ return '' ;
309
+ }
310
+
311
+ return apply_filters ('wpml_permalink ' , home_url ($ pageForArchiveUri ), $ currentLanguage );
303
312
}
304
313
305
314
public function setWpmlLsLanguageUrls (string $ url , array $ langs ): string
0 commit comments