0

I have add a extra colmn in WP_posts mysql database.

extra field in database

Is there a way to show and add this extra column in my custom post type.

what i mean

I don't want to use meta because it is placed in another table "WP_postmeta". I want to have al the content in one table.

The product information is imported from a .CSV this is why I want it in one table.

When I google for "Show and add textarea box in a custom post type" i only get the way to fix it with WP_postmeta. https:// wptheming.com/2010/08/custom-metabox-for-post-type/

Is there a way to fix this for the WP_posts table.

  • Changing the DB structure of wordpress is like forking the core code. Once you have done it you are by yourself as it is not wordpress anymore. – Mark Kaplun Apr 12 '17 at 10:24
  • I'd note that modifying the table schema can cause problems upgrading including potential data loss. You also won't get any of the benefits of object caching, or being able to use the built in APIs or REST APIs. Instead you'll have to query for posts by first name all on your own in raw SQL, and you'll have to fetch it yourself – Tom J Nowell Apr 12 '17 at 10:26
  • Also, the article you linked to is what you want, just replace the get_post_meta call with the SQL to retrieve your first name column. Again I STRONGLY recommend against this and advise you use post meta instead – Tom J Nowell Apr 12 '17 at 10:27
  • Oke it is not recommend it. I'll find a way with post meta to solve the problem. And put the CSV import content into the two tables. It's not going to be easy. Thanks for the important informtion @MarkKaplun – Kevinco Apr 12 '17 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.