Title: PHP 8.1 Error Uncaught TypeError: ltrim()
Last modified: December 5, 2022

---

# PHP 8.1 Error Uncaught TypeError: ltrim()

 *  Resolved [Adam](https://wordpress.org/support/users/dannythedog/)
 * (@dannythedog)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-8-1-error-uncaught-typeerror-ltrim/)
 * PHP 8.1
 * 06:03 AM 05 Dec
 * PHP Fatal error: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of
   type string, WP_Error given in /wp-includes/formatting.php:4379
 * Stack trace:
 * #0 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/formatting.php(4379):
   ltrim()
 * #1 /home/61095ae3c1ac1867dcd71efc/public_html/wp-content/plugins/slim-seo/src/
   MetaTags/CanonicalUrl.php(18): esc_url()
 * #2 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/class-wp-hook.php(308):
   SlimSEO\MetaTags\CanonicalUrl->output()
 * #3 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/class-wp-hook.php(332):
   WP_Hook->apply_filters()
 * #4 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/plugin.php(517): WP_Hook-
   >do_action()
 * #5 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/general-template.php(
   3043): do_action()
 * #6 /home/61095ae3c1ac1867dcd71efc/public_html/wp-content/plugins/oxygen/component-
   framework/oxygen-main-template.php(10): wp_head()
 * #7 /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/template-loader.php(
   106): include(‘/home/61095ae3c…’)
 * #8 /home/61095ae3c1ac1867dcd71efc/public_html/wp-blog-header.php(19): require_once(‘/
   home/61095ae3c…’)
 * #9 /home/61095ae3c1ac1867dcd71efc/public_html/index.php(17): require(‘/home/61095ae3c…’)
 * #10 {main}
 * thrown in /home/61095ae3c1ac1867dcd71efc/public_html/wp-includes/formatting.php
   on line 4379

Viewing 1 replies (of 1 total)

 *  Plugin Author [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * (@rilwis)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-8-1-error-uncaught-typeerror-ltrim/#post-16260393)
 * Hi [@dannythedog](https://wordpress.org/support/users/dannythedog/) ,
 * I see you’re using Oxygen to create the page. Can you share a screenshot of the
   page, or how do you setup the page? I tried to replicate the problem with Oxygen
   and PHP 8.1 and I couldn’t. Everything seems to be fine on my end.

Viewing 1 replies (of 1 total)

The topic ‘PHP 8.1 Error Uncaught TypeError: ltrim()’ is closed to new replies.

 * ![](https://ps.w.org/slim-seo/assets/icon.svg?rev=2005049)
 * [Slim SEO - A Fast & Automated SEO Plugin For WordPress](https://wordpress.org/plugins/slim-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/slim-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/slim-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/slim-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/slim-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/slim-seo/reviews/)

## Tags

 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)

 * 1 reply
 * 2 participants
 * Last reply from: [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/php-8-1-error-uncaught-typeerror-ltrim/#post-16260393)
 * Status: resolved