• Resolved teknikjgl

    (@teknikjgl)


    I’m trying to get the name of a table to use in my code. I use it in the admin backend for a filter. However, when I try to use tablepress_get_table_info() it says that the function is not defined. The same function works in the frontend, though. So I guess I can’t use it in WP Admin.

    I thought I could try grabbing the title based on the table’s ID but I can’t find how this ID is stored in the database, and hence can’t find the WP post ID for use in get_the_title() as the table_id is not the same as post_id. I can find the posts in the wp_posts table but the only meta keys I can find in the wp_postmeta table are _tablepress_table_options and _tablepress_table_visibility. None of which seem to link the post id and the tablepress id…

    Or is there another way to find the table name without tablepress_get_table_info()?

    • This topic was modified 2 years, 2 months ago by teknikjgl.
    • This topic was modified 2 years, 2 months ago by teknikjgl.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Are you already using TablePress 2.0? In that, I changed the loading mechanism, so that the template tag function tablepress_get_table_info() is also available in the admin area.

    It will however only be available when the tablepress_loaded action runs, which will be at some point when the init hook runs.

    The table ID to post ID relationship is stored in the tablepress_tables option in the wp_options database table. However, I really don’t recommend doing all this with custom code.

    Instead, let’s try to make tablepress_get_table_info() work here. Can you maybe check when you are trying to call it? Are you only doing this after the init hook, and are you using TablePress 2.0?

    Regards,
    Tobias

    Thread Starter teknikjgl

    (@teknikjgl)

    Thanks for replying so quickly! I noticed that I used an old version of TablePress. Updating solved the issue!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    great! Good to hear that it’s working now!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How are table id’s stored in the database?’ is closed to new replies.