Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:09:34+00:00 2026-06-03T06:09:34+00:00

There’s this problem that has been bugging me all day now, and I hoped

  • 0

There’s this problem that has been bugging me all day now, and I hoped you could help me. I’m currently developing a plugin for WordPress, to support tourdates as a post type (it’s for a band website). For the tourdates I need to know the Venue, so I created the taxonomy Venue. Now I want to add meta data to the taxonomy so I tried adding a table to my WordPress database. This is what I’ve got so far:

global $scooby_db_version;
$scooby_db_version = '0.1';

new Venue();

class Venue {
    function __construct(){
        add_action('plugins_loaded', array(&$this, 'install'));
    }

    function install(){
        global $scooby_db_version;
        global $wpdb;
        if(get_site_option('scooby_db_version') != $scooby_db_version){
            $table_name = $wpdb->prefix."term_meta";
            $sql = "
                ------- Taxonomy Meta -------

                CREATE TABLE $table_name (
                meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                term_id bigint(20) unsigned NOT NULL DEFAULT '0',
                meta_key varchar(255) DEFAULT NULL,
                meta_value longtext,
                PRIMARY KEY  (meta_id),
                INDEX term_id (term_id),
                INDEX meta_key (meta_key)
                );";
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
            dbDelta($sql);

            add_option('scooby_db_version', $scooby_db_version);
        }
    }
}

This does nothing at all. Appearantly it did work once, ’cause there is a entry in the options table, but it won’t update. It seems like the function is never called at all, but when it was (hence the db-entry) it did not create a table.

I’m really frustrated about this, because I can’t continue work on my plugin this way. Can you guys figure out what could be wrong? Why doesn’t it either call my function or update my database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:09:36+00:00Added an answer on June 3, 2026 at 6:09 am

    dbDelta is both handy and a bitch.

    http://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table

    • You have to put each field on its own line in your SQL statement.
    • You have to have two spaces between the words PRIMARY KEY and the definition of your primary key.
    • You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a website called Gild.com that has different coding puzzles/challenges for users to
There is probably an easy answer for this, but when I added DateTime.Now.ToString() to
There are a lot of SO questions that seem to address variations of this
There is a website that support shops information like food,drink,golf,spa. This websites provide information
There seems to be a similar question to this on here but with the
There are load balanced tomcat web servers. Every request could be served by different
There seems to be too many attributes/parameters in CSS... I want to know all
There is nothing like the 43rd day of your life spent tracking down issues
There are now so many ways to write windows apps, win32, MFC, ATL, .NET,
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.