0

I wish to get the file path to files other than images like PDF or TXT that are uploaded. Should I use wp_get_attachment_image_src or there's other function more suited for non-image attachments.

1 Answer 1

3

No, wp_get_attachment_image_src() is for image files only. For non-image files, you can use get_attached_file() to get the full filesystem path to the attachment file. And to get the full URL, you can use wp_get_attachment_url().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.