Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Retrieve user_meta and copy to post_meta

First of all get_users_of_blog has been deprecated, so you should use get_users instead, or run a WP_User_Query.

After that, the_author_meta echo the meta value, not return anything. To return the meta you should use get_the_author_meta()

$blogusers = get_users( $args ); // for args see codex

if ($blogusers) {
  foreach ( $blogusers as $bloguser ) {
    $user_location = get_the_author_meta('geo_address', $bloguser->ID );
    $has_meta = get_post_meta(463, 'geo_move', true);
    if ($user_location && ! $has_meta) add_post_meta( 463, 'geo_move', $user_location);
  }
}

Related Posts:

  1. Content hooks vs User hooks
  2. Job of meta_key meta_value fields in database tables
  3. get_*_meta doesn’t always return an array
  4. Like & Dislike functionality using JavaScript
  5. Array of user ids to list of user names
  6. get Insert id for meta field
  7. help to decipher wp metadata
  8. Check For get_post_meta on Author Archive Page
  9. show user based on user_meta
  10. Explanation of update_post_(meta/term)_cache
  11. How can I get the post ID from a WP_Query loop?
  12. Adding meta tag without plugin
  13. What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
  14. How to edit a post meta data in a Gutenberg Block?
  15. Sanitizing integer input for update_post_meta
  16. if get_post_meta is empty do something
  17. Remove WordPress.org Meta link
  18. Give extra post-meta to RSS feeds
  19. Can’t translate the post meta data (Date) in another language
  20. adding a URL to a post meta
  21. Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
  22. get_post_custom()
  23. Mass importing json data into custom fields (postmeta)
  24. How to echo get_post_meta (Fluent-Framework)
  25. How to add meta data to WordPress posts?
  26. How add post_meta from user_meta?
  27. get_post_meta remains empty while looping all menu items and using the ID
  28. how do I set a schedule event to modify all posts’s meta value weekly or monthly?
  29. How to stop wp_postmeta from being called on archive and search pages?
  30. WordPress front-end media (image) upload ERROR!
  31. running function during post save and adding variable to post meta
  32. update_post_meta saves nothing in database when run in publish_post
  33. Can’t access post meta on new post creation (cpt)
  34. How do I dynamically call a page/post author into the meta data?
  35. Set Condition echo function get_post_meta
  36. Custom post meta values reset by autosave [duplicate]
  37. Compare meta_query with a Regular Expression and do a less-than operation on it
  38. get_post_meta() not work for the first post inside the loop
  39. Custom query, multiple custom keys
  40. Trying to get property of non-object error using get_post_meta()
  41. How can I change the tag contents of individual WordPress posts?
  42. get_post_meta producing white screen of death
  43. update_post_meta not working in plugin
  44. Gutenberg: How to display meta field data in the block frontend (save function)
  45. Look up all posts by status or meta value – performance difference
  46. String taken from database table post_meta is showing HTML tags on Frontend
  47. Can A Post Meta Field Store multiple values that are not in an array?
  48. esc_attr on get_post_meta [closed]
  49. Sort custom posts in archive by multiple values: date AND meta key
  50. Delete posts based on post meta data
  51. How is the author’s name given a different color?
  52. How does WordPress treats attachments metadata in post content?
  53. How do I edit the posted “by” and “on” in the post meta
  54. URL to Post Meta [closed]
  55. Retrieving post meta array (attachment)
  56. Why is variable that get_post_meta stored in empty?
  57. using update_user_meta to rank users
  58. Stop `update_post_meta` from working each time page refreshes?
  59. Meta box with front-end styling
  60. Display Post Meta in Header
  61. get_template_part() isn’t loading author information
  62. Conditional For get_the_author_meta
  63. Custom fields or something else
  64. Is there a way combine posts meta_name?
  65. Format meta_value [closed]
  66. Compare User meta_value with Product meta_value
  67. I want to Add Feedburner Right After Meta Details
  68. if get_post_meta function returns empty – Do Not Display HTML
  69. Custom column on CPT not showing correct value when meta data not set
  70. How to access post meta on the first time a post is published
  71. Removing Malware
  72. I Can’t get the post_tag name from term_id using wp_set_object_terms
  73. After updating the custom post type, metafields disappear from the post.php edit menu, how do I fix it?
  74. Creating a custom post type upon registration for a specific user role
  75. How to update/add child posts meta whenever the parent post meta is updated?
  76. How to query post with meta?
  77. why is my postmeta table is so heavy
  78. update_post_meta() throws Uncaught error: Cannot create duplicate attribute
  79. Using a comma instead of a pipe to separate metadata
  80. Multiple meta key and value search in the query
  81. Meta keys won’t add using wp_insert_post
  82. How Can I extract Image urls from post meta
  83. Retrieve posts from meta key
  84. Assign postmeta in bulk
  85. Twenty Twelve entry meta data – change and move
  86. Re-order posts inside tax query
  87. How can I prevent the post_modified column in wp_posts from being updated?
  88. wordpress simple post multi rating with post_meta and user_meta
  89. Sorting meta box values by start- and enddate and all dates in between
  90. Use an id on a button to update_post_meta in post
  91. Using mysql queries to delete custom post types based on meta_value
  92. get_post_meta image width for lazy load
  93. Custom Fields help
  94. WP-API : post_meta not updated… but have another entry
  95. Parse error thrown by get_post_meta [closed]
  96. How to get all the related ids without array?
  97. Remove action of an external plugin after checking if custom post meta is set
  98. I am stuck between post meta function to call unique id
  99. Search posts by meta key in admin and front
  100. Add specific postmeta to search query
Categories post-meta Tags geo-data, post-meta, user-meta
How long is “as long as possible” in wp_cache_set()?
wp_option table error while importing

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress