User_login from wp_users to wp_usermeta (2 posts)

  1. oskarkxyz
    Posted 1 year ago #


    I need to do a script for my wordpress and I really need a wp_login in wp_usermeta. In wp_usermeta I can see only their ID and in wp_users I can see their ID and login.

    Is there a way to copy one column and add it into other table? Would be awesome if it would also updates automaticaly (when the orginal column updates also the copy does).


  2. Christian1012
    Posted 1 year ago #

    I don't think that's really what you want to do. They are in different tables for a reason, why would you want to duplicate tables in the same database?

    Can't you just include it in your query? Example:

    SELECT wp_usermeta . * , wp_users.user_login
    FROM wp_usermeta
    INNER JOIN wp_users ON wp_usermeta.user_id = wp_users.ID
    WHERE wp_usermeta.user_id = 1;

Topic Closed

This topic has been closed to new replies.

About this Topic