dimanche 1 février 2015

post_parent is 0 when uploading new files


I have a custom-type post I'm trying to attach some audio/wav files to using the wp-admin UI.


When I upload the new files using the Add Media popup those get saved and embedded into the post just fine, but in the database those attachment-posts have parent_post set to 0.


It records the post_date and post_author correctly, but not the post_parent.


What is the reason for that behavior and how can I fix it?


Update ok so this only happens to the posts with custom post-type. When I upload the same audio file to the normal post it gets attached properly. If I try disabling the plugins it will remove that custom post type I'm working with and I won't be able to test.


Update2 this happens during the upload process. Here's the var_dump($_REQUEST); output from wp-admin/async-upload.php when uploading an attachment to the regular post:



array(4) {
["name"]=>
string(42) "my_file.wav"
["action"]=>
string(17) "upload-attachment"
["_wpnonce"]=>
string(10) "457d8c9ee7"
["post_id"]=>
string(4) "1234"
}


The post_id key is missing when I'm uploading an attachment to the custom post.





Aucun commentaire:

Enregistrer un commentaire