Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28598 closed defect (bug) (invalid)

wp-db.php does not appear to have access to wp-config.php settings

Reported by: lord_boffo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Bootstrap/Load Keywords:
Focuses: Cc:


wp-db.php does not appear to have access to wp-config.php settings.

At line 949 in wp-db.php

if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) )
    $tables['users'] = CUSTOM_USER_TABLE;
if ( isset( $tables['usermeta'] ) && defined('CUSTOM_USER_META_TABLE' )
    $tables['usermeta'] = CUSTOM_USER_META_TABLE;

If I change the if statments to only use the isset(), then the values are set to the strings "CUSTOM_USER_TABLE" and "CUSTOM_USER_META_TABLE", not the values of those constants.

If I change the if statments to only use the isset(), and hardcode the values instead of using the constants, the hardcoded values are used.

If it is decided not to fix this, then http://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables needs to be changed as the instructions for custom user tables do not work when wp-db.php cannot see the constants that have been defined.

Change History (3)

#1 @johnbillion
7 years ago

  • Component changed from General to Bootstrap/Load
  • Keywords close reporter-feedback added

Thanks for the report lord_boffo, but I'm unable to reproduce the problem.

Are you sure you've defined the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE constants in your wp-config.php file? They are definitely available to wp-db.php once they're defined and there's no reason they wouldn't be, unless they've been added to the bottom of the file below the line that says /* That's all, stop editing! Happy blogging. */.

#2 @lord_boffo
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

The position of the settings in wp-config.php was the key. I have a long habit of adding new settings to the end of config files and it didn't occur to me to check setting position in the file. Thanks.

#3 @SergeyBiryukov
7 years ago

  • Keywords close reporter-feedback removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.