Getting the table prefix from wp-config.php and Upgrade with the same prefix (4 posts)

  1. girimb
    Posted 3 years ago #

    There is $table_prefix variable in wp-config.php. We
    set it to '@@DB_MAIN_PREFIX@@wp_'. However, customer can change it later, and
    this customer changed table prefix in his WP instance. After that customer
    upgraded to next WordPress version, and upgrade failed because we re-write
    configuration file on upgrade, and change prefix again, while customer tables
    had different prefix.

    We have to get the table prefix from wp-config.php where customer can change the table prefix and when upgrading that new version we need to upgrade with the same prefix which is in the Database, not with the Default prefix wp_table name.


  2. OptimalDevs
    Posted 3 years ago #

    global $wpdb;
    $table_name = $wpdb->prefix . 'table_name';

    Database Table Prefix

    Best regards, Alejandro Gálvez - OptimalDevs.

  3. HussainRoxx
    Posted 2 years ago #

    when i try to setup config while startup it shows me that table prefix can not be empty. while before i have not encountered this problem.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    @HussainRoxx: As per the Forum Welcome, please post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.