在 wp_user 表中添加新列 [英] add new column in wp_user table

查看:39
本文介绍了在 wp_user 表中添加新列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表 WP_USER 中添加新列是否好 - 或者 - 我应该在元用户表中添加内容吗?我在质疑这个,因为有一个WP功能

Is it good to add new column in table WP_USER - Or - should I add stuff in metauser table? I was questioning this because there is a WP function

/* Get full WP_User object instance. */ 
$user = new WP_User ($user->ID);

在 WP_USER 中添加列后是否也能正常工作?

Will that work as well after adding column in WP_USER?

推荐答案

如果您希望将自定义字段添加到您的用户,请使用 usermeta 或创建一个以 username 作为主键的新表.这将使您在更新方面成为未来的证明.

If you want custom fields to be added to your user, use the usermeta or create a new table with username as primary key. This would allow you to be future proof in terms of updates.

这篇关于在 wp_user 表中添加新列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆