How to get a Full List of your Post’s Meta Data

If you’re setting up a Meta Reference, but this isn’t showing up in your grid, the following tip can help to make sure the “Original Handle” being used is correct. This is useful for WooCommerce, Events Manager, and other CPT’s.

1. Temporarily add the following code snippet to your theme’s “functions.php” file.

function my_post_meta( $content ) {
 
    $my_meta = get_post_meta( get_the_ID() );
    $my_meta_data = '<pre>' . print_r( $my_meta, true ) . '</pre>';
 
    return $content . $my_meta_data;
 
}
 
if( !is_admin() ) {
 
    add_filter( 'the_content', 'my_post_meta' );
 
}

2. View one of your posts, pages or products on the front-end of your site.

The Meta Data will then be shown toward the bottom of the page and look something like the screenshot here:

In the screenshot to the right, the “Original Handle” for “Total Sales” is:

total_sales

and the “Original Handle” for “Sale Price” is:

_sale_price
How to get a Full List of your Post’s Meta Data

Further Resources for Web Design and Development Enthusiasts

Alright! We've embarked on quite an adventure exploring the realms of this topic. But why stop there? The world of web design and development is vast, and there's always more to learn and discover. Let's dive into some resources that'll keep your knowledge fresh, your skills sharp, and your passion ignited:

The Author

KC

Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

Liked this Post?
Please Share it!