Remove post with attachments hook
I’ve found out why it doesn’t work. My attachments were only added to the media library and weren’t attached to the post.
I’ve found out why it doesn’t work. My attachments were only added to the media library and weren’t attached to the post.
Got it : wp_update_post( array( ‘ID’ => $attach->ID, ‘post_parent’ => 0) ); to wp_update_post( array( ‘ID’ => $postID ‘post_parent’ => 0) );
This is how I resolved it: $myNewImg = get_post_meta($id, ‘usp-file-single’, true); if (isset($_POST[‘uploadImgCustom’])) { $myNewImg = $_POST[‘uploadImgCustom’]; } $attachments = get_posts(array(….
wp_get_attachment_image_src calling wrong location
Currently I’ve achieved a somewhat acceptable solution by using the do_shortcode_tag filter as mentioned in this answer, and using get_post_meta to fetch the value, as mentioned in this answer. There are (at least!) two caveats, however: The id in do_shortcode_tag‘s $attr isn’t the attachment post ID, but rather the CSS id from the original shortcode. … Read more
Sending Form data as Attachment
What is wrong with my wp_insert_attachment code?
Attachment metadata has value of ‘1’
file_put_contents($file, $msg_array); should be file_put_contents($wp_upload_dir[‘path’] .”https://wordpress.stackexchange.com/”. basename( $file ), $msg_array);
Zip a file and add as attachment