WordPress.org

Ready to get started?Download WordPress

Forums

Single DB Connection File for All Modules (4 posts)

  1. jbsprague
    Member
    Posted 9 years ago #

    Being a programmer, I would like to see a single connection class where I have to define my database and connection string only once. I find with all of the plugins that I have to keep redefining the connection string. All of the plugins etc would then call that single class.

    Of course this info already exists in the config file. Should there be a push from Core to say if you are going to connect to the database, pull the info from config?

    Thoughts?

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    I don't program at all, but I've used a lot of plugins - I don't recall ever having to give my config information to plugin.

  3. TechGnome
    Moderator
    Posted 9 years ago #

    Same here... I've written a couple of plugins that accessed the DB, and as long as I used the wp db class I haven't had any problems.

    Now, if the plugin dev didn't know how to do that, that's a different issue & should be taken up with the author.

    Tg

  4. RummandDan
    Member
    Posted 9 years ago #

    That is why you shouldnt use your own db layer, but use the one used in wordpress (global $wpdb object).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.