• Resolved Gone Fishin

    (@terryg-1)


    Hello,

    I am considering writing a very simple PayPal integration plugin. I have looked at other PayPal IPN plugins, and one used a custom post type with postmeta and taxonomy terms while the other used a custom db table.

    I have also read https://codex.www.ads-software.com/Writing_a_Plugin#Saving_Plugin_Data_to_the_Database , but I am still unclear as to which approach would be easiest/best.

    At that URL, it is recommended to use a new, custom database table for, “the type of data that will grow as time goes on, and that doesn’t have individual names.” That confuses me. What is an, “individual name”? Name of what?

    To me, it just seems like a kludge to put merchant transaction data into the posts and postmeta tables. But, is that actually acceptable?

    As I mentioned, this is intended to be a very simple plugin. It will not be for an e-commerce shop — more along the lines of membership subscriptions.

    What do you, who I’m sure are more expert than me, think?

    Lee

    P.S. I wish this forum had a search feature.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The only really correct answer is “it depends…”. There’s no rules or best practices as far as wusing which type goes, as it’s all up to how the data will be stored and used and will vary for each different use-case.

    In my own opinion, if you’re going to set up things that are displayed to the public, or things that are items in their own right, then setting up a custom post type is the best. For things that are extra or are more “meta” items, it’s best to set up custom tables. For your specific usage, I would think that a custom table would be the best way to go as the data in there is really relevant to a users account so it’s tied to something else. This will also let you store exactly the data you need and will cut down a bit on the amount of processing needed to get data from various tables as you’d need with post types and meta data.

    Thread Starter Gone Fishin

    (@terryg-1)

    The only really correct answer is “it depends…”.

    Lol. Yes, I figured something like that was forthcoming.

    What you said makes alot of sense. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Should plugin use own db table or custom post type / postmeta?’ is closed to new replies.