WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] $wpdb->prefix vs $table_prefix (2 posts)

  1. RoscoHead
    Member
    Posted 7 years ago #

    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

  2. Kafkaesqui

    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.