How to integrate custom database table in WordPress and using WordPress functions

This is precisely what custom post types are for.

If it were my project, I’d scrap the custom table you have, set up a custom post type for your “widgets”, add all your existing widgets as regular WP content, and use standard WordPress functions and templates to query and display them.

It’s a bit of investment in the short term (if you have a lot of existing data you need to migrate), but in the long run it’s best to have all your content in standard WordPress tables and display it using standard WordPress functions and templates–unless there’s a really compelling reason not to.

Leave a Comment