WordPress.org

Ready to get started?Download WordPress

Forums

User_login from wp_users to wp_usermeta (2 posts)

  1. oskarkxyz
    Member
    Posted 5 months ago #

    Hello.

    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).

    Regreds,
    Oskar.

  2. Christian1012
    Member
    Posted 5 months 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;

Reply

You must log in to post.

About this Topic