Support » Plugin: Download Monitor » Accessing Custom Fields/Meta Data

  • Resolved Angela


    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:

    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 ?>


    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]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Barry Kooij



    This is quite deep into custom development, so I can’t write the actual code for you. I can clarify that we don’t limit access to meta data in any way. Based on the code you’ve shared, my advise is to 100% verify the $id you’re working with is the actual download ID.

    Good luck and thanks for using Download Monitor!

    Kind Regards,

    Barry Kooij



    Thanks, Barry!

    Yep, after looking at it with fresh eyes, this was a case of user error. Now that I know, I can see about writing a snippet that will pull the metadata from the download itself rather than its host page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accessing Custom Fields/Meta Data’ is closed to new replies.