WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. girimb
    Member
    Posted 1 year 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.

    Thanks,
    Giri.

  2. OptimalDevs
    Member
    Posted 1 year ago #

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

    Database Table Prefix
    http://codex.wordpress.org/Class_Reference/wpdb

    Best regards, Alejandro Gálvez - OptimalDevs.

  3. HussainRoxx
    Member
    Posted 10 months 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 10 months 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

Tags

No tags yet.