php - Custom admin page: How to save changes specific to users

I created a custom admin page in Wordpress and it works as it should. I also figured out how to save things, and have it

I created a custom admin page in Wordpress and it works as it should. I also figured out how to save things, and have it displayed on the website.

What I just can't figure out is to save the changes to my custom admin page for that specific user.

Said in another way, you have to, for example, enter your phone number in an input field, where this phone number should appear on the website. I can do that part myself, but when other users access my custom admin page, they have to enter their own and not what another user has entered.

I created a custom admin page in Wordpress and it works as it should. I also figured out how to save things, and have it displayed on the website.

What I just can't figure out is to save the changes to my custom admin page for that specific user.

Said in another way, you have to, for example, enter your phone number in an input field, where this phone number should appear on the website. I can do that part myself, but when other users access my custom admin page, they have to enter their own and not what another user has entered.

Share Improve this question edited Aug 11, 2019 at 12:00 Matthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges asked Aug 10, 2019 at 17:40 Oscar S.Oscar S. 191 gold badge1 silver badge3 bronze badges 1
  • do you mean that you have multiple admin, so you need each one has his own options – Makiomar Commented Aug 10, 2019 at 18:42
Add a comment  | 

1 Answer 1

Reset to default 2

Then save the data in the usermeta table, linked to each user, by update_user_meta() and get_user_meta() functions. get_current_user_id() gives you the $user_id to pass. Choose a $meta_key that wion't create conflict, preferrably with a unique prefix. Same rule as for keys for saving data in options table.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745251065a4618679.html

相关推荐

  • php - Custom admin page: How to save changes specific to users

    I created a custom admin page in Wordpress and it works as it should. I also figured out how to save things, and have it

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信