Note, before going further: Take care about portability and security:
function wpse50056_get_post_meta()
{
global $wpdb;
$results = $wpdb->get_results( "
SELECT
ID,
post_date,
post_title,
post_content,
meta_key,
meta_value
FROM {$wpdb->posts}
INNER JOIN {$wpdb->postmeta}
ON ( $wpdb->posts.ID = {$wpdb->postmeta}.post_id )
" );
foreach( $results as $result )
{
printf( '<pre>%s</pre>', htmlspecialchars( var_export( $result, true ) ) );
}
}
add_action( 'shutdown', 'wpse50056_get_post_meta' );
Related Posts:
- Really simple query giving error in SQL syntax
- SQL query for custom taxonomy slugs
- How to optimize multiple insert into wordpress database
- How to store sensitive user data (passwords)
- I can’t write in my DB using $wpdb->insert
- How can I add an image upload field directly to a custom write panel?
- Should I use wpdb prepare?
- Is it mandatory to use $wpdb->prefix in custom tables
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- How to validate custom fields in custom post type?
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- $wpdb->insert_id
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Check for success of $wpdb->update() correctly
- Getting wrong relationship value in $args in wp_Query?
- WordPress and multithreading
- Creating custom field with drop down on new post page
- Save metabox with multiple checkbox array
- $wpdb->insert is changing a value
- Actions or filters fired when data is saved in a custom table
- How to create Image gallery Metabox in wordpress [closed]
- Display only certain posts based on visitor’s country?
- Utilize TinyMCE hyperlink chooser outside of TinyMCE
- anything like add_meta_box for categories?
- Custom Plugin Database relations
- why creating tables using $wpdb is not being executed while installing plugins?
- How to use mysql IN statement with wpdb update method?
- How to add SQL file with PHP to WordPress database [closed]
- template_redirect for single posts w/ custom fields
- Using $wpdb object in a widget
- Activation hook not creating table
- Support auto-save and revisions for custom fields
- Best choice of options/settings framework for plugin/theme development
- Ordering posts by metadata
- $wpdb -> Batch insert from XML File?
- How to Download and install plugin database remotely
- How to insert data to a database table when the field is not yet created?
- Where to store the name of a custom table?
- include wp-blog-header not working on MAMP
- Adding set of custom fields to WordPress Post in Dashboard
- get_posts() not working when accessing with a custom user role
- creating custom function to log actions in plugin
- Custom Taxonomy to dropdown box on adminside wordpress
- Issue regarding $wpdb->prepare()
- Error on inserting a form value to database
- How to create database table, add data, update and delete using wpdb via plugins?
- Create & Save multiple Meta-boxes
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Saving value of a selection option in comment form as comment meta
- Strange issue saving custom field data for a WooCommerce order
- Woocommerce – Convert Delivery method into a custom field
- how to search users by ajax live search
- Adding custom end points, No error line
- Intermittent database errors when accessing WordPress database
- How to get Metabox custom field to show checked if value is updated using post meta query?
- How do I update a field of a meta box?
- Storing data in wordpress database from ajax call from different website
- Input value from metabox is not found in $_POST after post save
- Run Shortcode of post’s custom field in functions.php / Plugin
- Custom code for WordPress dynamic menu
- wpdb->prepare and mysql UPDATE – how is it done?
- Checked() function on a multidimensional array
- What is the best way to store a few fields?
- Delist entries in the_loop
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- How can I add a simple custom field to my plugin?
- Ajax is not working in a loop
- $wpdb->prepare with LIKE and sprintf
- $wpdb->update() always need a second try
- Using AND and bracket grouping in SQL not working
- How to save post meta as an array in Gutenberg?
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- per blog metadata for plugin
- How to format custom fields when editing an attachment?
- Get emails from users by custom field SQL
- Data inserted by wpdb insert is different than data pressnt in database.
- Proper Prepare Statement for ALTER TABLE and using AFTER
- wpdb->get_var always returning 0
- $wpdb->prepare is not working like mysql_real_escape_string
- How to avoid conflicts with db.php / $wpdb and other plugins that decide to use them?
- $wpdb in php 5.5
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Plugin to create Posts and Forums then choose category and parent forum
- $wpdb->update Issue
- How to relate the Category to user?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Why doesn’t my Table get created?
- how to add custom fields into new & update post page?
- Customise Grouped Product display in Woocommerce with custom column
- How to display specific data from a custom table to logged in users with a custom role
- $wpbd->insert_id is returning null
- WP_Query not ordering correctly
- Adding customs fields on each product on the cart
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- WordPress Query doesn’t return the correct value
- add_meta_box does not display meta box in Admin
- User avatar-ACF fields
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- Update database record in plugin
- Organising and completing posts (mark as read and hide)