How to get all post meta from WordPress

Add below set of code to your functions.php and call it in theme where you want to show meta data.

 
<?php
 
function get-post_meta($post_id){
    global $wpdb;
 
    $data   =   array();
 
    $wpdb->query("
        SELECT `meta_key`, `meta_value`
        FROM $wpdb->postmeta
        WHERE `post_id` = $post_id
    ");
 
    foreach($wpdb->last_result as $x => $y){
        $data[$y->meta_key] =   $y->meta_value;
    };
 
    return $data;
}
 
?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us