0

I got this PHP error :

Notice: Constant WP_CRON_LOCK_TIMEOUT already defined in /htdocs/wp-config.php on line 195

I don't understand because when I do a search in the wordpress project with the word WP_CRON_LOCK_TIMEOUT I got just this result :

enter image description here

How PHP can say WP_CRON_LOCK_TIMEOUT is already defined if the second code line in default-constants.php is wrapped by a condition like this :

if ( !defined( 'WP_CRON_LOCK_TIMEOUT' ) )
    define('WP_CRON_LOCK_TIMEOUT', 60);  // In seconds

Notice : I did a google search and a load of web sites appeared with this error in the description so it's a common error.

  • Are you using a caching plugin? Possibly helpful: wordpress.stackexchange.com/questions/257489/… – Dave Romsey Mar 15 '18 at 18:31
  • I did not find a plugin about cache. Is there a cache system in wordpress by default ? – J.BizMai Mar 15 '18 at 18:51
  • There is no core provided file caching plugin in WP, so perhaps you are having a different issue. – Dave Romsey Mar 15 '18 at 18:55
  • 1
    Can we see line 195 of wp-config.php? Have you added stuff after the bit that says no editing past this point where it loads wp-settings.php? – Tom J Nowell Mar 15 '18 at 19:46
  • @TomJNowell this was my mistake. Moving them above the That's All resolved the notice :) – Jarmerson Sep 7 '19 at 23:46
0

Configurations in wp-config.php should be placed above the comment near the bottom that reads: That's all, stop editing! Happy Publishing.

Per Editing wp-config.php

The contents of the wp-config-sample.php file are in a very specific order. The order matters. If you already have a wp-config.php file, rearranging the contents of the file may create errors on your blog.

Here are those lines near the bottom:

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

/** 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've added my own configuration above those lines:

define( 'WP_CRON_LOCK_TIMEOUT', 120   ); 
define( 'AUTOSAVE_INTERVAL',    300   );
define( 'WP_POST_REVISIONS',    5     );
define( 'EMPTY_TRASH_DAYS',     7     );
define( 'WP_AUTO_UPDATE_CORE',  true  );

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

/** 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' );

Add your configuration accordingly and those notices should resolve.

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.