Hi,
thanks for your post, and sorry for the trouble.
The table ID to post ID mapping is stored in the tablepress_tables
option in the wp_options
database table. You could retrieve that array and then find the table ID for a given post ID.
You can also change the table ID to something else (like a post ID), but I’m not aware of a way to do that automatically.
Regards,
Tobias
Hello Tobias,
Thank you for replying. I get the following string with the WordPress function get_option(‘tablepress_tables’):
{“last_id”:18,”table_post”:{“1″:241,”2″:242,”3″:243,”4″:244,”5″:245,”6″:246,”7″:247,”8″:248,”9″:249,”10″:250,”11″:251,”12″:252,”13″:253,”14″:254,”15″:255,”16″:256,”17″:257,”18”:258}}
How can I convert this to a PHP array? Or do I need another function to get those values?
I tried the PHP unserialize() function. But without success.
Please let me know.
-
This reply was modified 1 week, 6 days ago by
Studioviv.
-
This reply was modified 1 week, 6 days ago by
Studioviv.
Hi,
this is JSON, so this should do it:
$option_value = get_option( 'tablepress_tables' );
$tables = (array) json_decode( $option_value, true );
$tables = $tables['table_post'];
Regards,
Tobias
Hello Tobias,
This is working perfectly. Thank you for all your help.
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!