php - This occurs when I open admin or front on localhost

admin2025-06-06  7

Recoverable fatal error: Object of class WP_Error could not be converted to string in H:\xampp\htdocs\edventus\wp-includes\default-constants.php on line 252

Recoverable fatal error: Object of class WP_Error could not be converted to string in H:\xampp\htdocs\edventus\wp-includes\default-constants.php on line 252

Share Improve this question edited Nov 3, 2018 at 8:24 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Nov 3, 2018 at 6:55 Ajeet WsAjeet Ws 11 bronze badge 2
  • Have you recently put anything in wp-config.php? – Jacob Peattie Commented Nov 3, 2018 at 7:02
  • no i did not add in this file – Ajeet Ws Commented Nov 3, 2018 at 9:33
Add a comment  | 

1 Answer 1

Reset to default 0

What version of WordPress are you running? Can you perhaps include the code from line 252 of that file? If it's a current installation of WordPress, then it's this:

/**
 * @since 1.2.0
 */
if ( !defined('COOKIEPATH') )
  define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );

... And I can't really see why that all of a sudden should fail. ... So perhaps try and activate another theme, to see if it's some buggy code in your current theme - or if it's a corrupt WordPress installation.

In order to debug it, then you could (TEMPORARILY!!) change it to this, and reload a page and see what it outputs:

/**
 * @since 1.2.0
 */
if ( !defined('COOKIEPATH') ){
  echo '<pre>';
  print_r( get_option('home') );
  echo '</pre>';
  die();
  define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
}

If you have access to the database, then you could also see in wp_options-table, what the value for option_name=home is. Maybe something or someone changed the home-name to something mysterical.

... Or since it's a local installation, then it could be because of a space in the folder-name (in case that you changed the path for security's sake)?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749209139a317275.html

最新回复(0)