1

I'm working on a front-end form plug-in and create shortcode to display front-end form on a page or post.

While I was testing, I found all image files uploaded by Add Media button which will be inlined in content will get post_parent value from the actual page/post that has my shortcode in it.

I want to update post_parent to the ID of newly created post that generated by my front-end plugin.

I'm assuming I can use

wp_update_post(
  array(
    'ID' => $att_id, 
    'post_parent' => $post_id
  )
);

But how I get all the IDs of images it will be inlined in content(Uploaded by Add Media button)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.