4

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
    do a search on all your files instead of trying to guess where it is – Mark Kaplun Aug 16 '14 at 6:20
  • 5
    I'm guessing that you're defining the constant in wp-config.php after WordPress has been loaded. Make sure that the define( 'WP_POST_REVISIONS', ... line is before require_once(ABSPATH . 'wp-settings.php'); – shea Aug 21 '14 at 11:49
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__) . '/');

/** 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

0

I have experience of same error like that:

Notice: Constant WP_POST_REVISIONS already defined in var/www/html/wp-config.php on 
line 95

And accordance code on line 95 is like following:

define( 'SCRIPT_DEBUG', true );

I make this 'false' and then move to line 86 above that commit:

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

And then it works. Hope your luck~

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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