Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

This topic contains 1 replies, has 0 voices.

Last updated by Bobby 2 months, 1 week ago.

Assisted by: Bobby.

Author Posts
February 11, 2026 at 5:21 pm #17813883

davidK-29

Description:

When using WPML + Yoast SEO + WPML SEO Multilingual (wp-seo-multilingual), a PHP 8.1+ deprecation notice is triggered on every page load:

PHP Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated
in /wp-includes/formatting.php on line 4496
Root cause:

Yoast SEO generates breadcrumb schema data (JSON-LD) for every page. The last breadcrumb item (the current page) intentionally has a null URL, since it is not a link.

The WPML SEO Multilingual plugin (wp-seo-multilingual) hooks into wpseo_breadcrumb_links via WPMLWPSEOYoastSEOPresentationHooks::translateBreadcrumbs() (Hooks.php, line 151) and calls apply_filters('wpml_permalink', $url) for each breadcrumb URL — including the null one.

The WPML core handler WPML_API_Hook_Permalink::wpml_permalink_filter() in class-wpml-api-hook-permalink.php (line 40) then calls esc_url_raw($url) without checking if $url is null, which triggers the deprecation.

Stack trace:

#0 ltrim() — wp-includes/formatting.php:4496
#1 esc_url() — wp-includes/formatting.php:4628
#2 sanitize_url() — wp-includes/formatting.php:4608
#3 esc_url_raw() — class-wpml-api-hook-permalink.php:40
#4 WPML_API_Hook_Permalink::wpml_permalink_filter()
#5 WP_Hook::apply_filters()
#6 apply_filters('wpml_permalink') — Hooks.php:151
#7 WPMLWPSEOYoastSEOPresentationHooks::translateBreadcrumbs()
#8 YoastWPSEOGeneratorsBreadcrumbs_Generator::generate()
Suggested fix (either location):

Option A — In wp-seo-multilingual, Hooks::translateBreadcrumbs() should skip the wpml_permalink filter call when the URL is null.

Option B — In sitepress-multilingual-cms, WPML_API_Hook_Permalink::wpml_permalink_filter() should add a null guard:

public function wpml_permalink_filter( $url, $lang = null, $absolute_url = false ) {
if ( $url === null || $url === '' ) {
return $url ?? '';
}
// ... existing logic ...
return esc_url_raw( $url ?? '' );
}
Environment:

WordPress 6.9.1
PHP 8.1+
Yoast SEO 26.8
WPML (latest)
WPML SEO Multilingual (latest)
Current workaround (in theme's functions.php):

add_filter( 'wpml_permalink', function ( $url ) {
return $url ?? '';
}, 9 );

February 12, 2026 at 12:28 am #17814551

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

If possible, please update the WPML plugins to their latest versions and let me know your results, does the issue persist?

I have created a sandbox environment and was not able to reproduce the warnings, could you please let me know if I am missing something.

hidden link

Note, sandbox has PHP 8.3

The topic ‘[Closed] wpml_permalink filter does not handle null URL — PHP 8.1+ deprecation in esc_url_raw()’ is closed to new replies.