WordPress page to populate WP database

I have a custom page on my WP instance which I want to interact with my database instance, ideally the standard table WP uses for posts.

This page pages retrieves an online stream from a set of social network channels, and I do want to persist this stream into the database so to form a sort of “archive”.

Read More

So I have two questions:
a) Would it better creating a separate table, or is it more convenient adding everything in the wp-post table (or whatever it is called), classifying the item as social or something else
b) How can I interact with my WP database using WP Api so to not reinvent the wheel?

Thanks

Related posts

Leave a Reply

1 comment

  1. Normally, we should only create our own tables if WordPress features and organisation are not enough to deal with our data.
    Nowadays, Custom Post Types (wp_posts db table) and Custom Fields (wp_postmeta db table) are used in a variety of plugins (from Advanced Custom Fields to WooCommerce).

    Then we use, among others, WP_Query to retrieve data and wp_update_post() and update_post_meta() to insert data.

    In any case, data validation and security checks are always important.