Okay
  Public Ticket #3539421
wordpress table prefix
Closed

Comments

  • Pierre started the conversation

    I create some wptables with mysql queries.

    The issue i have is that the wordpress table prefix can change if i copy my dev to prod. How can i retreive and use the table prefix from wordpress

  •  1,708
    Miloš replied

    Hi, 

    Sorry for the waiting time.

    We don't work on weekends so it adds two days to the waiting time.

    we appreciate your patience.

    When you changed the domain, the path to the files for the source data of tables most likely changed, and it is also possible that you changed your Database Table Prefix.

    If i understood, you can see the tables in your WordPress database, and you have already migrated everything.

    if you correctly migrated everything, but the table data is empty, then the path to the files most likely changed.

    Here is what you can do to fix it.

    First, to check what is the "new path" for tables on your new site,

    you can create a new table linked to any Excel file ( or CSV file), and it should generate just fine. 

    Once you do that, access your database, and open 'wp_wpdatatables' database table.

    ( the wp_ prefix is default WordPress Database table prefix, on your site it might be different)

    In the "content" column, you will see the path related to the new table. 

    6078389527.png
    1893629511.png

    So, if the new file is stored in (for example):

    /var/www/html/your_NEW_site/wp-content/uploads/2021/02/file-one.xls

    And your old files are in:

    /var/www/html/your_OLD_site/wp-content/uploads/2021/02/file-two.xls

    You need to modify the content column for each row, and replace the path.

    To do that, you can run this SQL command on your database ( via your database management tool, such as PHPMyAdmin):

    UPDATE `wp_wpdatatables` SET content=REPLACE(content,'this_part','that_part')
    

    Please bear in mind that wp_ is the default prefix of WordPress, 

    but on your site it could be anything, so you should run `your_prefix_wpdatatables` and actually replace the part of the path in "this_part" and "that_part" sections.

    Additional step if you have Manual Tables, then most probably you also have a different SQL Database Table Prefix now on your new Site.

    If you can access directly to your Database, via PHPMyAdmin or any other DB Management Tool ( you can ask your hosting support if you're not sure how to access it);

    then you can run this Query on your Database, in order to update to your current DB Table Prefix in our Plugin's data:

    UPDATE `wp_wpdatatables` SET mysql_table_name=REPLACE(mysql_table_name,'wp_','NewDBPrefix_');

    Please bear in mind that wp_ is the default table prefix of WordPress,

     but on your old and new site it could be anything, so check what is your DB table prefix,

    then you should run `your_prefix_wpdatatables` and actually replace the part of the path in wp_" and "xyz_" sections.

    That replaces the prefix in the "mysql_table_name" column. 

    Once you do this, you should be able to simply load all your manual tables without issues.

    -

    If you're unsure how to do this, we can do it for you if you can provide me with a temporary WP-Admin user (administrator) credentials, 

    and database (phpMyAdmin) URL with access credentials.

    If you send us access, just make sure to mark the reply as PRIVATE , so that only we can see it.

    I hope that helps.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables