Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pendari

    (@pendari)

    I don’t want to post real site information here. I will create an actual support ticket on your site for that exchange.

    Thread Starter pendari

    (@pendari)

    OK, thanks for pointing me in the right direction. That will help a lot if I do end up going the route of building a custom routine. Thanks Malay!

    Thread Starter pendari

    (@pendari)

    Hi, Malay, thanks for getting back to me quickly.

    It would be a few hundred logins. The ideal workflow would be a bulk create procedure with an email sent after each one. It could be processed in smaller batches, not necessarily all at once.

    It sounds like I’ll need to find some other approach unless there are hooks where I can call your plugin from another script.

    Thread Starter pendari

    (@pendari)

    I wanted to tack something on here since I did actually find a way to do this and it might help someone else…

    I looked in the wp_postmeta table and saw how the values were saved when I had multiple people related to a single publication (the pendari_publication_related field is in the publication custom post type).

    meta_id post_id meta_key meta_value
    80286 3902 pendari_publication_related 2411
    80290 3902 pendari_publication_related 2316

    In my case, post_id is the publication and meta_value is the person (and of course meta_key is the slug of the field). So the mechanism is actually pretty simple and as long as you have the current post_id and the ID of the person, all you need to do is loop through creating DB entries (meta_id is an auto-increment id field).

    I had followed the WP All Import add-on API (https://www.wpallimport.com/documentation/addon-dev/overview/) to create a plugin to do a lookup of the person ID on the fly during an import, so then inside that loop, I used WP’s add_post_meta() function to make the DB entries and it built all my relational connections.

    Thread Starter pendari

    (@pendari)

    Ah OK, that explains it… I found another post from Nov 2017 where someone asked about this same thing, so I guess it’s a tricky fix. I would love to have this ability since this issue comes up regularly for my team and it would save us many, many hours. Thank you!

    Thread Starter pendari

    (@pendari)

      $meta_boxes[] = array(
        'id'   => $prefix.'relationships',
        'title'    => 'Options',
        'pages'    => array( 'pendari_publication'),
        'context' => 'normal',
        'priority' => 'high' ,
        'fields' => array(
    
    ...
    
          array(
            'name'    => 'Authors',
            'id'      => $prefix . 'related',
            'type'    => 'post',
            'post_type' => 'pendari_people',
            'field_type' => 'select_advanced',
            'placeholder' => 'Select...',
            'desc'    => "Contributor to this publication",
            'std'     => false,
            'multiple' => true
          ),
    
    ...
    
        ),
      );
    
    

    The content type is for academic publications and we relate them to authors (another custom post type, pendari_people). Everything works when entering data normally.

    Using WP All Import to import/update 500+ records saves the other fields properly, but nothing goes into this field for the relationship. I’m not sure if I’m feeding the field the wrong data, using the wrong format or if there’s something else I’m doing wrong.

    I don’t think there’s a helpful screenshot since the process runs successfully (no error messages that I can see), but then there’s no data in this field. If you need anything else from me, point me the right direction and I’ll get it for you ??

    Thank you, Long!!!

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