Neden wordpress bu şekilde yeni oluşturulan tablo erişemiyor?

0 Cevap php

Ben zaten başarıyla tabloyu yarattık:

function jal_install () {
  global $wpdb;
  global $jal_db_version;
  $table_name = $wpdb->prefix . "liveshoutbox";
  if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
      $sql = "CREATE TABLE " . $table_name . " (

id mediumint(9) NOT NULL AUTO_INCREMENT, time bigint(11) DEFAULT '0' NOT NULL, name tinytext NOT NULL, text text NOT NULL, url VARCHAR(55) NOT NULL, UNIQUE KEY id (id) );";

    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     dbDelta($sql);
     $welcome_name = "Mr. Wordpress";
     $welcome_text = "Congratulations, you just completed the installation!";
     $insert = "INSERT INTO " . $table_name .
           " (time, name, text) " .
           "VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
     $results = $wpdb->query( $insert );
  }
}

jal_install ();

Ama WP gibi kendi iç tablolar anlamına gelir ne kadar bu tabloya bakın çalıştığınızda $wpdb->posts:

var_dump($wpdb->liveshoutbox);

Çıktısı:

null

Neden?

0 Cevap