Never modify the WordPress core table schemas, such as wp_users
etc under any circumstances.
The next time WordPress changes its tables, your custom columns will be destroyed, and all the data will be deleted. This is unavoidable.
Instead, use the User Meta API and table:
Retrieving a user meta:
$phone = get_user_meta( $user_id, 'phone_number', true );
Adding/updating a user meta:
update_user_meta( $user_id, 'phone_number', '0123-456-7890' );
Where $user_id
is the ID of the user
Never modify the tables, store the data in the meta tables instead using the functions.
Related Posts:
- Rename a table in MySQL
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- Keeping WP database synced across multiple developers using git
- Staging sites, how do you manage synchronising updates in the DB?
- How to get the post publish date outside the loop?
- Using transients in conjunction with memcached
- How to define composite keys with dbDelta()
- Has parent field in the table wp_term_taxonomy has term_id or term_taxonomy_id
- Forcing nickname as display_name in custom edit profile template
- Connect forms in WP to external database
- Export WP database for import using WP-CLI on Vagrant Box
- How to get site URL if database is disconnected?
- Is it wise to delete post revisions and autosaves from database?
- Showing content from another wordpress installation database in the page template loop?
- Multiple WP install with same users database
- Dynamic data in `wp_register_script` needed
- Why is $wpdb->get_results failing on certain tables but not others (which have data)?
- Using two different DB users on one WP install
- Usage of Direct Database Call Without Caching Error
- How to correctly add a table to the WordPress MySQL database
- Can I transfer a mysql database to another site?
- How to verify password outside WordPress?
- Weird issue with database migration and SSL links
- Backup another database with BackUpWordPress plugin [closed]
- Easiest Way to Authenticate WP Users Using an External DB?
- How to use a different database to list and manage comments in the backend
- How do I properly update the WordPress database password?
- wpdb_prepare with multiple or condition
- $wpdb->insert is not working
- WordPress Install and Database on separate hosting?
- Moving a site from a temporary domain to the live domain [duplicate]
- Error establishing a database connection on Installation
- What is this in my tables
- Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?
- WP get stuck with a query on MySQL when the site is resumed
- Use mulitple usernames?
- Routine to convert custom post meta from old to new value
- Trying to change database tables storage engine to innodb gives error “invalid default value for ‘post_date'”
- database connection [closed]
- sanitize POST arrays
- WP character encoding error after sharing post on Facebook �
- Sending data with multi step form to wp database
- Able to use all admin pages but in the frontend there is a “Error establishing a database connection”-Error
- WordPress query is not returning proper results
- Undefined Variable: mysqli error when connecting to database
- Localhost to Staging to Development Dynamic WP-CONFIG
- Selectively restoring original posts from a compromised site to a freshly installed WordPress database
- can we add extra table or column in wordpress for adding our data
- Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?
- $wpdb is not initiating
- Duplicated site isn’t recognized as a site
- My options table is huge. What can I do?
- Changing root password in PHPMyAdmin for WordPress Database when going live
- How to properly check if a table exists in WordPress Database using Show Tables Query
- WooCommerce: remove sample & dummy data
- multiple wordpress installation with shared usertable on an different database
- wordpress database restore – broken link
- 6 random character prefix automatically added to entire DB tables, how / why? [closed]
- Some weird users in database
- cannot connect database
- How to delete a particular row in a database table
- Location of image metadata on my server
- How to create more than one new wpdb object?
- Connecting to wordpress database in my application [closed]
- Is it good practice to import/export a blog to test a redesign?
- Getting value from database table depending on field value
- Getting “Error Establishing a Database Connection” on localhost in new Mac OSX Lion environment
- Secure way to use name_save_pre?
- wpdb->insert not inserting first variable
- Database tables for sports betting integrated in WordPress
- change the year on all of my custom post types?
- WordPress keeps redirecting to localhost
- get value from ‘terms’ table
- custom tables in wordpress Database? (can i just create them with sql?)
- New installation fatal error in 5.9.3 at edit or create entry
- Storing transients giving database error
- I want to replicate a wordpress website over multiple servers
- Displaying requested data from a the database in wordpress
- Accidently changed the GUID
- Is there anyway to split posts to different databases?
- wp-cli + valet: “Error establishing a database connection”
- local wordpress broke after changing URL
- Unable to login to a https website via the app after changing from http
- Is it safe to add INDEX to a column in WordPress database?
- Restore Old Database Over Newer WP & Plugin Files
- Not sure what to do next to optimize
- Database structure for thousands of posts
- How do I find out from my database what version of WordPress I need?
- How to create a database table?
- $wpdb not working
- Accessing content from third party as native posts in WordPress
- Extracted CSV as Array for Custom Query Loop
- Hang Up Followed By Can’t select database
- One WP Database outside localhost and two connections
- Fetch data from another site, but the same database
- Every time I update or install a plugin I get “Error Establishing a Database Connection in WordPress”
- Create hundreds of users with just ID in phpMyAdmin
- Upload wordpress from localhost to 000webhost
- WP Multisite Users Not Linking
- Query a meta key using an array of values where the database value is a string