WordPress.org

Support

Support » Plugins and Hacks » [Resolved] $wpdb->prefix vs $table_prefix

[Resolved] $wpdb->prefix vs $table_prefix

  • RoscoHead

    @roscohead

    I’m wondering which is best to use in plugins for extra tables. The docs at http://codex.wordpress.org/Creating_Tables_with_Plugins says to use $table_prefix, but that requires an extra global declaration, as $wpdb is usually already declared global where needed.

    Is it because $wpdb->prefix wasn’t always available? If so, which version did it appear?

    Thanks, ROSCO

Viewing 1 replies (of 1 total)
  • Kafkaesqui

    @kafkaesqui

    Personal preference. I tend to use $table_prefix, but that’s because I’m used to it. And it’s unlikely to vanish into deprecation hell, considering its purpose in wp-config.php. But one should probably consider $wpdb->prefix more in line with current WP coding practices.

    I’m fairly sure $wpdb->prefix made it’s first appearance with 2.0.1. I seem to recall a personal bug hunt related to it.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] $wpdb->prefix vs $table_prefix’ is closed to new replies.
Skip to toolbar