1 comment

  1. Your meta field contains the ID of the attachment, you need to fetch that ID, then get the filename using that attachment ID.

    $doc_id = get_post_meta( get_the_ID(), 'pdf', true );
    $filename = basename( get_attached_file( $doc_id ) );
    echo $filename;
    

Comments are closed.