Accessing Custom Fields/Meta Data
-
I’m working on a client’s site (link) and have discovered that I can’t access meta/custom field values I’ve manually assigned to a download. The fields are being set correctly, and I can see that they exist in the wp_postmeta DB table when I search for the download ID. (Screenshot of DB search results: https://i.imgur.com/XkkwkuD.jpg)
I can work around this using the Short Description on the actual download page, but on the parent “Podcasts” page, I’d like to display the custom field keys/values for the podcast duration and recorded-on date.
The code I’m testing with:
$duration = get_post_meta($id, 'duration', true); $record_date = get_post_meta($id, 'record_date', true); $thumb_id = get_post_meta($id, '_thumbnail_id', true); // Test $meta = get_post_meta($id);
The “duration” and “record_date” variables are empty when echoed on the page:
Duration: <?=$duration ?> Date: <?=$record_date ?> Thumb ID [test]: <?=$thumb_id ?>
==
Duration: Date: Thumb ID [test]: 7579
My
print_r($meta)
results:Array ( [_thumbnail_id] => Array ( [0] => 7579 [1] => 7579 ) [_wpt_short_url] => Array ( [0] => ) [_wp_page_template] => Array ( [0] => page-download.php ) [_dp_original] => Array ( [0] => 7530 ) [_edit_lock] => Array ( [0] => 1507152808:2 ) [_edit_last] => Array ( [0] => 2 ) )
Is there any chance or reason DLM might be disallowing access to custom fields? I hope I’m not missing something obvious. Any help you can provide will be amazing!
The page I need help with: [log in to see the link]
- The topic ‘Accessing Custom Fields/Meta Data’ is closed to new replies.