How to display users attachments

Support MB Custom Post Type How to display users attachmentsResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33347
    synchrosynchro
    Participant

    Hello,

    I have a CPT where users can upload files. The files are important, not the posts.

    And I have a user account page and link to the page for posting new entries (custom posts with files).

    And everything works, except I can't display the list of uploaded files in the user account.

    So to make it clear: I don't want to display the list of custom posts in the user dashboard, I want to display them the list of all files they have uploaded.

    When I am using the dashboard shortcode I can see all the posts that user created. But for those posts I only created a custom field for file upload, no title, no content, so in the result I get a list of (no-title) entries. And when I click the link I get 404. But when I click edit button I can edit the uploaded file (form the user account).

    The ideal situation would be if I could get that list of attachments without the need of going into the posts.

    Can you help me get it right, please?

    #33356
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is not possible to show only uploaded files on the frontend dashboard. The uploaded files are the post meta, associated with the posts. You can create a custom query to retrieve all posts then get and show the file (post meta) only on the user account page.

    Refer to the documentation
    https://developer.wordpress.org/reference/classes/wp_query/
    https://docs.metabox.io/fields/file-upload/#template-usage

    #33417
    synchrosynchro
    Participant

    Thank you for your answer, I get it now.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.