• Resolved Timoxendale

    (@timoxendale)


    Hey, so I’m wrapping the shortcode with the switch_to_blog() function but it still doesn’t load other tables from other sites, is there a way I can grab other tables on other sites within the Multisite install?

    switch_to_blog(1);   
    do_shortcode( '[table id=2 /]');
    restore_current_blog();
    
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.

    To be honest, I have no idea why this wouldn’t work…
    Can you maybe try using the template tag function

    tablepress_print_table( array(
      'id' => '2',
    ) );
    

    Regards,
    Tobias

    Thread Starter Timoxendale

    (@timoxendale)

    Hey, thanks for that but still no look.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ok, I took a deeper look at this, but didn’t find a working solution ??

    Basically, this comes down to the list of tables (the mapping from table ID to WordPress post ID) being an “autoloaded” WP Option (an entry in the wp_options database table).
    This is automatically loaded by WordPress, very early during the page execution. TablePress then uses that value to initialize its list of tables. And this information is not updated with the change of the site ID. It would be necessary to “clear” the loaded WordPress options and then re-initialize TablePress, but I don’t see a good or easy way for that.

    Your best solution might be to manually export/import the table in question to the desired site as well, or maybe use the TablePress Extension from https://tablepress.org/extensions/table-auto-import/ for some automation.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP Multisite and accessing different tables.’ is closed to new replies.