Hi,
thanks for your post.
Your description is only partially correct. TablePress does not store the table data in the wp_options
table anymore. Only WP-Table Reloaded does that (in the option that you have found).
1) This depends on how you uninstall WP-Table Reloaded. There’s a checkbox on the “Plugin Options” screen of WP-Table Reloaded that will let you decide what shall happen when the plugin is deactivated. There’s also a button there to directly uninstall it and have all data removed (which is what I’d recommend after you have migrated to TablePress and everything is working).
2) Yes, that is by design, as TablePress now stores the table data as JSON encoded string in a Custom Post Type (which is then stored in the wp_posts
table).
3) No, there are no plans to move to a separate database table. The current Custom Post Type solution works fine.
Regards,
Tobias
I have a couple of follow up questions to this.
1) I deleted the WP-Table plugin via WordPress’ Plugins area. I forgot about WP-Table having an uninstall option. Is there any danger in not using its uninstaller? Is there any danger in reinstalling the plugin and then running the uninstaller? All the tables appear correctly otherwise.
2) As stated above, I am using a custom function that queries the Tables depending on the season:
get_option(“wp_table_reloaded_data_”.$substr($season, -2));
This works great except when the table id is:
wp_table_reloaded_data_1
The table ID 1 displays correctly both in the admin area and the front end via the shortcode. But if I were to use PHPMyAdmin and look at the above field, it contains data for a completely different table (in my case, table ID 13); thus, the results for get_option table ID 1 is incorrect because the field has incorrect data.
I should state that there is a field named wp_table_reloaded_data_13 and it does contain table 13’s data. The field wp_table_reloaded_data_1 should contain table 1’s data but it does not.
How do I get table ID 1’s data into wp_table_reloaded_data_1?
Hi,
1) No, there’s no problem if you uninstalled WP-Table Reloaded without the uninstaller. The difference is that the uninstaller will delete all WP-Table Reloaded tables and all plugin settings from the database.
So, unless you have migrated everything to TablePress, you might not want that. If you want that, yes, you can re-install WP-Table Reloaded and then use the uninstaller.
2) That sounds really weird, and I have no clue what’s wrong there. If it displays correctly in the admin area and on the frontend, there’s no real way that the option can be wrong…
Are you sure that you are really loading the correct option?
Now, anyway, as you should migrate everything to TablePress, there’s no real need to investigate this further with WP-Table Reloaded, but to change your code to use TablePress.
Regards,
Tobias
Update on this.
I reinstalled WP-Table and ran its uninstaller which deleted the old WP-Table tables. Having both WP-Table and TablePress installed didn’t hurt anything on the front end but my application was reading the old tables which of course was no longer being updated by TablePress.
I then rewrote my custom application to automatically extract the post id from tablepress_tables (in wp_options) relating to my $season variable and then use WordPress’ JSON decoder (json_decode) to fill an array from the post id (in wp_posts).
It all works like a charm.
Hi,
very nice! Good to hear that you were able to solve this 🙂
Now, to maybe make this more robust, you could actually simply use the TablePress function to load a table. That way, you wouldn’t have to do everything yourself. Try for example this PHP code that will return the table as an array:
var_dump( TablePress::$controller->model_table->load( '123' ) );
Regards,
Tobias