I made a local clone of a website that’s running LIVE in order to safely work offline for a while. On every page of the local version I get a HUGE warning which says

Notice: Constant WP_POST_REVISIONS already defined in C:\xampp\htdocs\local-tutorials\wp-config.php on line 95

I guess it’s been defined twice, once in wp-config.php and once elsewhere, right? However, I’ve no clue where it’s been defined for the second time.

I searched wp-config.php for a second instance but no luck. I then checked the functions.php in my theme but it doesn’t contain any statement on revisions.

Googling leads mainly to rather old threads that seem to address a different issue.

I believe the error is related to a reasonably recent (< 1 year?) WordPress update since it didn’t occur previously but I’m not 100% sure on that.

Thank you in advance for any suggestions.

UPDATE

After searching all files, three contained wp_post_revisions:

  • C:\xampp\htdocs\local-tutorials\wp-config.php
  • C:\xampp\htdocs\local-tutorials\wp-includes\default-constants.php
  • C:\xampp\htdocs\local-tutorials\wp-includes\revision.php

I commented out the wp_post_revisions in default-constants.php and this seems to solve the problem. I find that a bit awkward since wp-config.php is (partly) meant to override default constants.

So I think it’s strange I get this huge error when I do so. Or am I missing something?

2 s
2

I have the same problem before.
I put WP_POST_REVISIONS in the end of wp-config.php file and it didn’t work correctly.
You should put your codes before defining ABSPATH and before this line:

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

it must be something like in the following:

define( 'WP_POST_REVISIONS', 6 );
/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . "https://wordpress.stackexchange.com/");

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

I hope it solves your problem.
So don’t put your codes in the end of wp-config.php file

Leave a Reply

Your email address will not be published. Required fields are marked *