Get Post Metadata

Here is how to get post metadata from a post or custom post type.

//Get Post Title
$pTitle = get_the_title($post->ID); 

//Get Post Content with Formatting
$pContent = apply_filters('the_content', $post->post_content); 

//Get Post Featured Image ID
$pImage = get_post_thumbnail_id($post->ID); 

//Get Post Featured Image URL
$pImageURL = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); 

//Get Post Metadata
$pMeta= get_post_meta( get_the_id(), '_postMetaID', true ); 

Here is an example below :

$pickupAvailability = get_post_meta( get_the_id(), '_wc_local_pickup_plus_local_pickup_product_availability', true );
[instagram-feed feed=1]
© 2024 BenaDigital Limited | All Rights Reserved
magnifiercrosschevron-down