I have a custom database table within wordpress database.. I filled this database with data and wordpress posts table with matching ids

an example would be...

wp-posts table has

    id - title
    1  - record1 title
    2  - record2 title

custom table has

    id - title          - data1 - data2 - data3
    1  - record1 title  - 20g   - good  - 200USD
    2  - record2 title  - 30g   - fine  - 100USD

I can reach data with custom php coding and sql queries when i open a post

lets say if i go www.demo.com?p=2 I can display,

Title -> record2 **with the_title()**
details -> 30g - good - 200USD **with php+mysql**

what i want to do is connect them with custom fileds so that i will be able to edit them in backend and display them more easily without writing custom php+mysql coding..

I checked ACF and several custom field plugins.. they seem to create their own tables or store data in postmeta

This wont work with me since i am using this external table with other php coding other than wp.

I looked at some frameworks also.. Couldnt find the best answer yet..

since i have same id's for wordpress posts and custom tables records is there an easy way to do it without writing code.. Or less coding..


  • As long as you use a custom table, you will need custom MySQL statements to get to your data. There is no way WordPress can know what's outside the standard table structure without custom coding.
    – Jan Beck
    Commented Jun 3, 2015 at 12:54

2 Answers 2


After long searches and tries I ended up with "Pods Framework".

It gives me a choice to store my custom field values to a custom table within wordpress database.

Now i am able to query them with other sources (such as other web apps that shares the same database).


There are filters in get_metadata() and WP_Query that you can use to alter the SQL, but I am sure that is not an exhaustive list of the filters that you would need to worry about. What you are attempting, or seem to be attempting, is a big project. Be warned. And it is much to big to tackle here from scratch.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.