• Resolved jakobmetro

    (@jakobmetro)


    Is there a simple php function I can call within my theme’s function.php that can add my given attachment id, and then set the folder for the attachment? I’m trying to set up an upload process via a form that the user submits, which I’ve hooked up to take that image form field and save it as an attachment post in the wp media gallery. The only step I have left is to set the folder of that attachment. Is there a simple php function I can call that can do that?

    I see in your documentation, there is a json api, but that seems overkill to open a connection, set up a bearer token, etc. to the site’s own json api just to set a row in a table… I’m already within the site, the json api only seems useful if I’m trying to do that outside of my current wp instance (for some reason). Just want to see if there’s a better way, or if I’m missing something.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Set attachment folder via php’ is closed to new replies.