WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Importer
The attachement and the meta fields are not importing (5 posts)

  1. prionkor
    Member
    Posted 3 years ago #

    Problems:
    1. media does uploads but the attachment to the post is lost.
    2. The meta field get the notice like:

    Notice: Undefined index: price in /home/content/c/h/r/chrisrobi/html/robitaillepaintings/wp-content/themes/paint-shop/functions.php on line 153

    Hi, I have done some research which might help. I am saving the post type meta fields via this:

    update_post_meta($post_id, "price", $_POST["price"]);

    So you see the the field 'price' i am saving from $_POST["price"] and it is getting unset when the plugin trying to saving the meta field. It try to run the save_painting_options() functions when it tries to update the meta field.

    So, is the problem is associated with my code? i suppose so, but all the resources i get form the net is using the same method to insert the meta field value to database.

    And another problem is the attachments are uploading successfully but not attaching to posts.

    Please advice.

    http://wordpress.org/extend/plugins/wordpress-importer/

  2. Jon Cave
    WordPress Dev
    Plugin Author

    Posted 3 years ago #

    The post meta problem sounds like it has nothing to do with the importer. Without seeing the code I cannot say for sure (I guess it's a custom theme as I couldn't find it in the repository). My guess is that the theme is calling update_post_meta on every page load but $_POST['price'] is not set on every page load and so there is the notice (it also sounds like poor security as anybody could set $_POST['price'] and get information stored in the database).

    Could you explain the media problem a bit more? Are you saying that the images or whatever are being uploaded and can be seen in the Media menu, but they don't show properly in posts? Could you give me a link to a post showing the problem? Is this occurring after you have tried to use the wordpress-importer plugin to importer a WXR XML file?

  3. prionkor
    Member
    Posted 3 years ago #

    Meta Problem:

    The notice is showing when the importer trying to create the post because i have added the update_post_meta() to the action "save_post"

    If the meta problem nothing to do with importer then still the importer does not importing any post meta.

    About the security: i am checking with wp_nonce.

    Media uploading:

    When i am in media library. Every media is shows the post name with which it is attached to right? The attachment info obtained when any media placed/inserted in the post.

    But in wordpress you will notice if you upload any media via the uploader and not inserted to the post it still got attached to the post. In this case the media/image is missing the parent info.

    I hope it is clear now? If it is still unclear i will provide the code. Thanks!

  4. Jon Cave
    WordPress Dev
    Plugin Author

    Posted 3 years ago #

    The notice is showing when the importer trying to create the post because i have added the update_post_meta() to the action "save_post"

    You should check isset( $_POST['price'] ). The importer doesn't have a form for the price so the post data isn't set; I would think the same kind of thing would happen with QuickPress on the dashboard too.

    If the meta problem nothing to do with importer then still the importer does not importing any post meta.

    Post meta is imported from the contents of the file. In the post <item>s you will see <wp:postmeta> tags which hold any post meta stored for a post.

    When i am in media library. Every media is shows the post name with which it is attached to right? The attachment info obtained when any media placed/inserted in the post.

    But in wordpress you will notice if you upload any media via the uploader and not inserted to the post it still got attached to the post. In this case the media/image is missing the parent info.

    Still not entirely sure what you mean by this. Could you give me an example of what's wrong. So, row in the database before export, <item> in the export file and the row in the database after importing (double checking that any IDs, e.g. post_parent, are pointing to the correct post). This might be a lot of info. so could you either put it on a pastebin website (e.g. pastie.org) or email it to me.

    If you could provide an example export file that isn't working correctly for you that would be great. Email: wp {AT} lionsgoroar.co.uk

    Edit: Sorry think I've got it now: Imported media isn't showing which post it's attached to on the Media screen -> "Attached to" column after importing to a new site.

    I am unable to reproduce this myself so sending me an export file that doesn't work for you would be the best course from here... see above.

  5. prionkor
    Member
    Posted 3 years ago #

    Hi, migrate the site in hard way. I mean replacing the content and database. But we will continue this thread to find the issue. I will send you more details in sometime. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic