How to change product fetching database table in wordpress

Viewed 36

Right now my product related data is being fetched from wp_posts table whereas i want it to be fetched from wpstg0_posts table.

Both the tables are in the same database, i cannot merge the data as it would collide the ID's in both.

Basically I want the products and all the related data to be fetched from prefix wpstg0_ instead of wp_

1 Answers

You Can't Do Thatâ„¢.

Well, you probably could, but you'd break a lot of code in WordPress core, and in the theme and plugin ecosystems. It would take a long time to develop your changes, and you'd be fixing bugs forever. Plus, you would have to backmerge each successive update from WordPress, WooCommerce, and whatever theme and plugins you use.

WordPress and WooCommerce are organized around the uniqueness of post ID values. That is, many features of the meta and taxonomy subsystems use post IDs.

WooCommerce exploits those subsystems to organize products.

You can stand up a different WordPress instance in the same database and give it a different table prefix name.

Are you trying to solve a performance problem? Try putting better indexes on the tables. @RickJames and I have a (free non-monetized) plugin for that. And try implementing a persistent object cache (with redis or memcached).

Related