Wordpress 中的自定义用户字段(对用户隐藏) [英] Custom User Field in Wordpress (Hidden from User)

查看:31
本文介绍了Wordpress 中的自定义用户字段(对用户隐藏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种方法,可以在 Wordpress 中为用户添加自定义字段,但我不希望用户看到该字段.它将由管理员输入和查看,但不应显示在注册页面或其个人资料页面上.

I'm trying to find a way to add a custom field for users in Wordpress, but I don't want this field to be seen by the users. It'll be entered and viewed by an admin, but it shouldn't be shown on the registration page or their profile page.

有没有简单的方法可以做到这一点?如果是这样,我可以指出正确的方向吗?

Is there an easy way to do this? If so, may I be pointed in the right direction?

推荐答案

您可以使用 add_user_meta() 函数添加您想要的任何元数据.

You can use the add_user_meta() function to add any metadata you would like.

为了仅向管理员级别显示它,您应该使用 wordpress 的 条件标签之一,除了简单的用户级别检查.

In order to display it only to admins level, you should use one of wordpress´s conditional tags, in addition to a simple user level check.

这篇关于Wordpress 中的自定义用户字段(对用户隐藏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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