Support » Fixing WordPress » Site down, wp_error could not be converted to string…

  • Hi, this morning I’ve found my site down. The last editing was yesterday, and after that everything was OK.

    Now I have this everywhere, including the admin login page:

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/setarep/public_html/wp/wp-includes/default-constants.php on line 135

    The line it refers to:

    define( ‘WP_CONTENT_URL’, get_option(‘siteurl’) . ‘/wp-content’); // full url – WP_CONTENT_DIR is defined further up

    I read through the related topic, but none of the answers did help. Many of them does not

    I turned off the plugins from the database, but nothing has changed. (Plugins are still off.) Breadcrumbs are also off.

    I’m out of ideas, could you please give some help? The site is:


Viewing 15 replies - 1 through 15 (of 27 total)
  • Hi, klebercz, & welcome to the WordPress support forum. First, thank you so very much for including a site link. You have absolutely no idea how much it helps when trying to diagnose problems like yours.

    I’m wondering–could you explain what sort of edit you did?

    If you’re using a theme that’s not a WordPress default theme, please rename your theme folder, either by using FTP (preferably secure FTP) or your host provider’s file manager by putting a 1 or a .old at the end of the folder name, i.e., mytheme1 or mytheme.old. Then please try logging into your dashboard (the actual site itself won’t work now until you activate a default theme).

    If that doesn’t work, please try renaming your plugins folder to plugins1 & see if that works.

    Because the line is referencing your wp-content url, you also might find the following resource helpful:
    especially the part starting w/the heading WordPress Address (URL)

    Please keep us apprised.

    Hi Jackie, thank you for the hints.

    The last bit of editing I did two days ago was adding a few ordinary pages – pure text – and change the text in the top bar. It’s a plugin named something like Top Bar. After that the site has worked well.

    Now at first I’ve renamed the theme directory, later the plugin directory, but nothing has changed. I’ve got the same error message everywhere, including the login page.

    So if you have some more hints I would really appreciate it.

    klebercz, please try re-uploading WordPress, including your themes & plugins, & let’s see if that fixes the problem.

    Also, do you have anything in your wp-config.php file that refers in any way to url? Please do not post the entire wp-config.php file here, unless you edit out the database name, username, & password first.

    Did not find URL references is wp-config.php. I paste it down below expect the access data.

    Sorry, I don’t understand what “re-uploading WordPress” means.

    * The base configuration for WordPress
    * The wp-config.php creation script uses this file during the
    * installation. You don’t have to use the web site, you can
    * copy this file to “wp-config.php” and fill in the values.
    * This file contains the following configurations:
    * * MySQL settings
    * * Secret keys
    * * Database table prefix
    * * ABSPATH
    * @link
    * @package WordPress

    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */

    /** MySQL database username */

    /** MySQL database password */

    /** MySQL hostname */

    /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’, ‘utf8’);

    /** The Database Collate type. Don’t change this if in doubt. */
    define(‘DB_COLLATE’, ”);

    * Authentication Unique Keys and Salts.
    * Change these to different unique phrases!
    * You can generate these using the {@link secret-key service}
    * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
    * @since 2.6.0


    * WordPress Database Table prefix.
    * You can have multiple installations in one database if you give each
    * a unique prefix. Only numbers, letters, and underscores please!
    $table_prefix = ‘****’;

    * For developers: WordPress debugging mode.
    * Change this to true to enable the display of notices during development.
    * It is strongly recommended that plugin and theme developers use WP_DEBUG
    * in their development environments.
    * For information on other constants that can be used for debugging,
    * visit the Codex.
    * @link
    define(‘WP_DEBUG’, false);

    /* That’s all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined(‘ABSPATH’) )
    define(‘ABSPATH’, dirname(__FILE__) . ‘/’);

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . ‘wp-settings.php’);

    Hi, klebercz. What I mean by re-uploading WordPress, & the steps to do so, is explained here:

    Before doing that, however, I would like you to please rename the theme folder you’re currently using, as well as the entire plugins folder & try logging into your dashboard. If you’re able to do that, then please switch to a default theme such as twentysixteen. If not, then I suggest you get a new installation of WordPress as well as any plugins/themes you use by following the steps in the article linked to above.

    Thanks, I have renamed the current theme folder and the plugin directory, still cannot log in. Same error about line 135.

    If I get it right now I need to reinstall WordPress.
    – at the first time I did it thorough CPanel. Can I use that method again?
    – what happens to the data (pages etc)? I have some xml backup, but its a bit old. I have a database backup, but it was made after this convert-to-string error. Is there a way to keep the data that must be somewhere on the server?

    klebercz, I think 1 of the possibilities we need to consider at this point is that your site was compromised. I’m not sure that’s the case–not at all, in fact, but I think it’d be better to assume it was.

    So, here are some things I think you should do:
    * Scan the machine you use to log into your website for malware.
    * Log into your website using a secure network. If you use a wireless network, ensure it’s secured w/a strong password. Don’t use cafes, hotels, airports, railway stations, etc.
    * Change your hosting control panel/FTP password. Make sure it’s long, contains upper & lowercase letters, as well as numbers & punctuation signs. For 1 of many articles regarding this, you might want to consult:
    The same will hold true w/your dashboard password following a reinstall of WordPress.
    * If you still have your .htaccess file, please paste it here so we can have a look. Sometimes the bad actors leave traces of their activities there.

    Given the error we’re seeing, the database might still be intact. You can open the database in a text editor of your choice to view it, or you can go to PHPMyAdmin or Webmin in your hosting control panel & browse the tables to see what’s there. If you do use your hosting provider’s control panel autoinstaller to reinstall WordPress, there’s often an aplet called Softaculous. If you click on the ‘Advanced Options’ you can specify a database. If the database contains your content, choose that 1, & your install should be ok.

    If The site was compromised, then not only do we want to restore the site, but also keep the bad guys from gaining entrance again, otherwise we’re just repeating the cycle.

    Please paste your .htaccess file in your next reply, & please let us know how the reinstall progresses.

    Hi, it took me a while to mess up everything when trying to reinstall WordPress. Later the whole thing turned hopeless (good backup deleted by mistake), and I asked the host if he had a backup of the whole site. Luckily enough he has one, so now an end of March status is restored.

    The main page comes back with a nice Hungarian message:
    Hiba az adatbázis-kapcsolat létrehozása során

    Failed to establish database connection.

    It seems that the restored database is one folder deeper than the old one was. I guess there must be a way to tell WP where to find the database. I try to read through the topics, but first I wanted to tell you how things are going.

    Now, it was fast but useless. 🙂

    Found wp-config.php, saved backup.

    Changed these values:

    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘name from MySQL Databases page’);

    /** MySQL database username */
    define(‘DB_USER’, ‘username I’ve just created’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘password I’ve just created’);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    Tried with just ‘localhost’ and with ‘localhost:xxxx’

    None of them did the trick.

    Hey, it’s done! Had to provide some privileges to WP, and the database connection has been established.

    Now I’v got the good old

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/setarep/public_html/wp/wp-includes/default-constants.php on line 135


    Did the usual staff, renamed the Plugin and the theme-in-use folders, but did not help.

    Uploading an even earlier backup in progress.

    klebercz, you’ve been busy while I slept lol. Time zones!

    I really think you need to reinstall WordPress entirely from a fresh copy available at, configuring it w/the values of the database you used. I sincerely advise that you do not use a previous backup of the WordPress files themselves. If you’ve purchased plugins or themes, then either reupload these from your computer or obtain them from the vendor.

    The other thing is, as I believe I pointed out, this problem might be indicative of a site compromise. That’s another reason to reinstall w/a fresh copy. Please also seriously consider changing your hosting provider password.

    Lastly, thanks for translating the Hungarian. Had it been German, Spanish, or Norwegian, I’d have understood, but not Hungarian, unfortunately.

    Keep us apprised, ok?

    Hi, I have reinstalled it several times, but nothing good came out.

    On Monday I will ask the host to restore the latest version so at least an up-to-date database will be available. Then I will install a brand new copy of WP, and will report the error message I’ll got. 🙂

    Thank you for the care.

    I opened a site of mine today with the same error and was able to solve it using this link:

    Seems that in the database the Site – URL got changed. I don’t know how and I have changed my passwords to login to the database.

    Hope that helps.!


    PS if you have caching turned on for you site, either flush it after you do this or turn it off.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Site down, wp_error could not be converted to string…’ is closed to new replies.