Support » Plugin: Pods - Custom Content Types and Fields » retrieve added user fields with sql

  • Resolved tonvandervalk66


    Hi, I added some number fields to the user with a pod. I can display them in a post and even edit them with a form. THat is really cool. Now I want to retrieve those field values with an SQL-query, to create a chart of the average values. I can find the datatables wphy_users and wphy_usermeta, but those tables do not contain the extra fields I created with the pod. Or am I mistaken?

    What is the name of the table with these fields? I see a table called wphy_podsrel, but I cannot output that table. In the user pods the fields are called vakx, vaky and vakz.

    I tried to understand the information on this page:
    Do I have to look into wp_postmeta.meta_key?

    Any help would be highly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I am already one step further. This query at least shows the desired values from wphy_usermeta:
    SELECT wphy_usermeta.meta_key,
    FROM wphy_usermeta
    GROUP BY wphy_usermeta.meta_key

    Now I would need to find out how to select the specific fields vakx, vaky and vakz

    SELECT wphy_usermeta.user_id,
    FROM wphy_usermeta
    WHERE 1=1
    AND wphy_usermeta.meta_key IN (‘vakx’,’vaky’,’vakz’)

    This seems to work. Thanks for the help! 😉

    Plugin Author Jim True


    Sorry we didn’t jump in here before you found the answer yourself. I always recommend if you want to know how the queries are put together from Pods to use a plugin like Query Monitor; it allows you to see the actual SQL queries by plugin or module. UserMeta (in wp_usermeta) is a funny beast (in much the same way that postmeta is) and it looks like you found out the connection; it’s key/value pairs matched up by user_id to wp_users.

    Remember, if you ever need a faster answer, you can bring it to us on our Slack Chat at

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘retrieve added user fields with sql’ is closed to new replies.