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 wordpress post-meta using php not wordpress functions

The reverse mechanism should work. I assume you are trying the get post metadata with the post row.

$resultat = mysqli_query($con,"SELECT * FROM wp_postmeta 
                                 LEFT JOIN wp_post 
                                 ON wp_postmeta.post_id = wp_post.ID 
                                 WHERE wp_post.post_type="shop_order"");

However, there will be a lots of duplication. If one post have 100 metadata, you are also getting the post row 100 times.

Related Posts:

  1. Use ajax to update_post_meta
  2. Undefined function mysql_connect()
  3. MySQL column count doesn’t match value count at row 1 [closed]
  4. Undefined function mysql_connect()
  5. Fatal error: Call to undefined function mysql_connect()
  6. Fatal error: Call to undefined function mysql_connect()
  7. Deprecated: mysql_connect()
  8. MySQL “Or” Condition
  9. How to update custom fields using the wp_insert_post() function?
  10. the_date() not working
  11. How to return number of found rows from SELECT query
  12. dbDelta support for FOREIGN KEY
  13. Transaction when using WP functions rather than vanilla SQL?
  14. Can i use php sql functions instead of $wpdb?
  15. is it possible to run some php code within a wordpress page?
  16. How to correctly submit a search form and display the result in an independent page
  17. Get meta_id along with meta_key and meta_value
  18. Query both first_name and last_name from wp_usermeta at the same time
  19. Check if post of title already exists
  20. $wpdb->delete column values IN ARRAY()?
  21. How to validate WordPress generated password in DB using PHP?
  22. How to get the list of WooCommerce product image of a certain category from database?
  23. How to use update and delete query in wordpress
  24. How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
  25. How can merge two arrays values in one array and save in database
  26. Check if user already visited this post today
  27. Custom query to get post names beginning with a digit
  28. How to make WordPress plugin check for database changes and then do something?
  29. Custom SQL query to get List of posts with featured image url
  30. Display all meta for a post?
  31. How To Make Connection To WordPress Data Base In A Plugin?
  32. How to add query vars with paginated URLs?
  33. Changing user_nicename
  34. Does WordPress cache get_user_meta() results?
  35. How to display multiple Post meta_key/meta_values by SQL query
  36. the_post_thumbnail() based on the Post ID
  37. How to use multiple query with same meta key
  38. WordPress will not operate correctly
  39. How to Join two tables from separate databases within WordPress
  40. How to update single value in multi dimensional Post Meta?
  41. tag search using WP_Query
  42. simple wordpress ajax plugin not working when not logged in
  43. Delete post revisions on post publish
  44. Jquery ajax to custom php file: returning blank data
  45. Add value to usermeta without removing previous values?
  46. Using Echo in ShortCode – Stuck
  47. Problems migrating WordPress to localhost
  48. MySQL query performed 4 times inside loop
  49. Show only one post for each author ( Page loads too slow )
  50. error importing localhost export file to server
  51. Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
  52. How to sort results from a custom database table
  53. Install will not load: PHP does not have MYSQL installed
  54. Why is my get_post_meta always empty
  55. Update some database fields when post is saved
  56. How can I call a row of user specific data from a custom table added to the WP Database
  57. Compare two meta key values against each other inside the get_posts array?
  58. Insert post without actions/hooks
  59. How can update custom meta for all posts
  60. Your PHP installation appears to be missing the MySQL extension which is required by WordPress
  61. How to merge local and live databases?
  62. How to track a users progress through pages by inserting data into WordPress Database?
  63. the_author_meta not working
  64. Import 10,000 Users into WordPress WITH a specific ID for each user
  65. Modern Tribe Calendar wp-query with meta query not working at all
  66. WP database error for comments_popup_link()
  67. if statement on database query
  68. Is the regular ajax request method safe or I should use admin-ajax.php?
  69. Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
  70. Successful or Error Message after running mysql code in functions.php
  71. sql query to put quotes around numbers in img tag
  72. No wp-config.php file on local install of wordpress – site still displays
  73. How to get the post_id from postmeta
  74. Sortable admin column for one meta key with three possible meta values
  75. WordPress Ajax Custom Query – High CPU LOAD
  76. AJAX in WordPress, sending coords data to MySQL and show after into map
  77. Performance issues with large website [closed]
  78. Create a quick start wordpress installation [closed]
  79. How to migrate the posts from an old custom legacy blog to a new WordPress website?
  80. theme options echoing multiple times
  81. PHP/MySQL issues when running WP on EC2 cloud [closed]
  82. Insert all post IDs in new database table
  83. WordPress 3 – how are passwords stored and how do I compare to them?
  84. Styling images coming from another blog
  85. WordPress get pagination on wpdb get_results
  86. register_activation_hook isn’t adding table to DB
  87. mysqli_real_connect() – authentication method unknown to the client Warnings
  88. Is the outdated PHP mysql extension a requirement for WordPress 4.6?
  89. How to create another version of my site based on the same database
  90. What SQL / WordPress queries would need a nonce?
  91. Different database query in function.php using mysqli
  92. how to echo all tables that start with a prefix
  93. how to increase custom post value by one most efficiently?
  94. Batch update a post meta field value of each post in Post Type
  95. Do I need to prepare query before get_results(), get_row() and get_var()?
  96. Strange wordpress slowness
  97. How to create and work with custom data / tables (i.e., for arbitrary data)?
  98. How to Display Image Meta underneath EVERY image in EVERY post
  99. Looking for most performant way to execute several similar WP queries within shortcodes
  100. Query String being Removed Creating a Pagination Issue within a Custom Plugin
Categories PHP Tags mysql, php, post-meta
Save data of select list after clicking save
Merge / Combine two php functions for Previous and Next Link with Thumbnail

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