HowTo: Custom Post Type (Meta) to Custom Table

Should I store the Custom Post Type data in the Custom Table (vs. wp_posts)?

Yes, wp_posts has really no space for custom data. The only place would be wp_postmeta. Since we’re throwing the argument out of the window, you’d store any additional info tied to a post in your custom table.

Should I store the Custom Post Type’s metabox data only in the Custom Table?

That entirely depends on you. You can use a combination of the two, too. You can store simple things in wp_postmeta if you like, and the rest in your custom table, or everything in your custom table. If you’re greatly extending what the custom post is, you can store that in your custom table, but for meta data like yes/no values, you can keep storing them in wp_postmeta.

Do I use the save_posts hook to handle DB Crud?

Yes, you would. Keep in mind that it gets fired for everything all the time. So a few checks, such as whether you’re saving the post type you’re interested in and whether this is a manual or auto-save, are required, but with save_post you’re guaranteed to always catch every save (incl. when something is newly added).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)