I'm working on a website using ampps local server. when I try to edit any page this error occurs.

Catchable fatal error: Object of class WP_Error could not be converted to string in /Applications/AMPPS/www/wp-includes/formatting.php on line 1111

This is the line on formatting.php

line 1110 function wp_check_invalid_utf8( $string, $strip = false ) { line 1111 $string = (string) $string;

  • Can you see what the error you're getting is, i.e. the contents of the WP_Error? You probably just need to fix that to save again. However it might make sense to modify wp_check_invalid_utf8 accept and pass through a WP_Error object, and if the source of the WP_Error and the route through wp_check_invalid_utf8 is all core code and not a third-party block or plugin then this is a WordPress bug.
    – Rup
    Aug 19, 2019 at 10:36

1 Answer 1


i think you should overwrite old file with NEW WORDPRESS file (formatting.php)

  • It already looks up-to-date to me, or at least the line numbers match 5.2.2, and I see the same lines on trunk at 1113 and 1114. Has there been a recent fix for this?
    – Rup
    Aug 19, 2019 at 11:47
  • which theme you are using ? custom theme or wordpress default theme ?
    – Rahul vats
    Aug 19, 2019 at 11:50
  • Thanks Rahul, It worked for me
    – Saqib Khan
    Aug 19, 2019 at 13:23
  • I thought It is solved but the error is still there, I'm using a custom theme
    – Saqib Khan
    Aug 20, 2019 at 6:10
  • Okay then disable your custom theme and activate twentynineteen theme, and check is issue is still same, if issue will not come with twentynineteen theme then your theme has an issue
    – Rahul vats
    Aug 21, 2019 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.