Support

Account

Home Forums ACF PRO Problem with importing Data into Post Object Field

Solved

Problem with importing Data into Post Object Field

  • Hello

    I have 2 custom post types: Products & Reviews. I created some fields for that specific post type – Reviews. One of the fields is POST OBJECT type, on the return I have selected ‘post object’, not post ID, post object was preselected as a default and I just left it the way it was.

    This post object type field is loading posts from Products post type, this way when I create a new post in Reviews, with this field I can assign it to another custom post type “Products” and on products I display the info from Product post and all the review CPT posts, that are connected to that specific Product via the POST OBJECT field.

    To give clear example. I have few products, but have plenty of reviews for each of these products. When I write a new review in backend, in the post object field, It gives me titles of products, I choose which product this review is related to and then on product page I display product info, along with all its reviews.

    Everything seems to be working fine, when I create new post manually, but problem comes when I try to import bunch of reviews. I use WP All Import PRO plugin to import reviews from CSV file, when importing to Post Object field, I have tried both values, Post Title and Post ID but none of them work, import is done correctly, all other data is showing up as they should etc…

    I just dont understand what type of value this Post Object expects, is it should be Post Title? post ID? in the field settings itself (Return Format), should I leave it to be Post Object or should I change it to Post ID?

    Your input is much appreciated.
    Thank You

    —- Versions —-
    ACF PRO v5.3.2.2
    WP v4.3.1

  • P.S.

    After import is done, in Database, I see that values are given for that specific field like this:

    META KEY | META VALUE
    _product_to_review | field_55673b42dafbd
    product_to_review | 385

    It seems to be correct, if I submit all this info manually, when everything is working fine, this is exactly the same values for the Meta Value, that I get in Database.

    So, if I manually choose some product in dropdown, in the POST OBJECT type field, lets say that product has post ID 385. I click save / update, and value gets stored and is visible on frontend as well.

    But If I do the import, value is stored in database, however, in the backend when I go inside the edit window for that review, the dropdown field (POST OBJECT) is empty, no value preselected and doesnt show up on frontend as well.

  • alright, so, I was able to solve my own problem and will post it below. I hope it will help someone who is desperate like I was for last couple days :))

    Step 1) Switch Your Post Object type to >> POST ID << in the return radio buttons

    Step 2) Import the data with everything EXCEPT the POST OBJECT FIELD data, first we need to import the posts to create them

    Step 3) Import the Data again, but dont create new posts, just use Title or any Identifier from CSV / XML to match and identify the post and Only update the POST OBJECT Field type.

    Pat yourself on back and get a cup of coffee or beer :))

  • Hey ringit,

    I contacted Soflyy team about this issue and they have just fixed it in the last beta version (wpai-acf-add-on_3.1.5-beta-1.0). You can download it on https://www.wpallimport.com/portal/.

    kind regards,
    Frank

  • I’ve run into this same issue. Data being imported from post object from my custom post type is not being set. I tried ringit’s solution but no luck. I’ve tried mutliple different ways and I am using the most up to date version of WP Allimport.

    The data for the post object import contains the slug of the post (not the post id even though I have it set, i am guessing this was the fix Soflyy applied) but it still doesn’t work for my custom post type

    Any ideas?

  • I’m having the same issue! No details in the documentation either. Did anyone figure this out?

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Problem with importing Data into Post Object Field’ is closed to new replies.