Title: Code replacement after plugin update
Last modified: August 22, 2016

---

# Code replacement after plugin update

 *  Resolved [grayg](https://wordpress.org/support/users/grayg/)
 * (@grayg)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/)
 * Hi! Awesome plugin!
    Just a little problem, I have a template that would search
   products, but after updating the plugin this code does not work anymore:
 *     ```
       $tablepress_tables = TablePress::$controller->model_table->load_all();
       foreach( $tablepress_tables as $table ) {
           // $table is now the table array, with ID, name, and description
       }
       ```
   
 * Is there something to replace this code? Thanks in advance!
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [tdn2kit](https://wordpress.org/support/users/tdn2kit/)
 * (@tdn2kit)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185714)
 * Hi,
 * $table in this result only have id. Nothing more, but, I find out we can edit
   file **models\model-table.php** in 252 line.
 * `$table = $this->load( $table_id, false, true); // Load table without data and
   options to save memory`
 * Good luck to you
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185731)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * Yes, the loading mechanism changed slightly, to make better use of caching.
 * You will therefore need to extend your code a little bit:
 *     ```
       $tablepress_tables = TablePress::$controller->model_table->load_all();
       foreach( $tablepress_tables as $table_id ) {
           $table = $this->load( $table_id );
           // $table is now the table array, with ID, name, and description
       }
       ```
   
 * Please never modify plugins files, tdn2kit, this is never a good idea as you 
   will again lose those changes after a plugin update.
 * Regards,
    Tobias
 *  [tdn2kit](https://wordpress.org/support/users/tdn2kit/)
 * (@tdn2kit)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185734)
 * Hi,
 * So, TobiasBg was right. I was change it back, with new fix:
 *     ```
       $tablepress_tables = TablePress::$controller->model_table->load_all();
       foreach( $tablepress_tables as $table_id ) {
           $table = TablePress::$controller->model_table->load( $table_id );
           // $table is now the table array, with ID, name, and description
       }
       ```
   
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185735)
 * Hi,
 * very nice! Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](http://wordpress.org/support/view/plugin-reviews/tablepress)
   here in the plugin directory. Thanks!
 *  Thread Starter [grayg](https://wordpress.org/support/users/grayg/)
 * (@grayg)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185878)
 * Hi!
 * Thank you all for your help..I tried the solution and works like a charm!
 * More power to your plugin!
 * Regards,
    Gray
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185889)
 * Hi,
 * no problem, you are very welcome! 🙂
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/view/plugin-reviews/tablepress)
   here in the plugin directory. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Code replacement after plugin update’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/code-replacement-after-plugin-update/#post-5185889)
 * Status: resolved