• Resolved cantoute

    (@cantoute)


    Here is my scenario:

    I imported relations that where in ACF based on post meta into wp_podsrel using SQL.
    Now this is all looking good, I’d like to have matching post meta values set too (they are handy when using WP_Query)

    Is there a easy way to achieve this?
    Opening in editor each post one by one and “Re-Publish” does the trick, but when using “group editing” it doesn’t seem to work on my setup.
    Should it do the same thing as when editing one by one?
    Having a few thousand entries to deal with… would be a pain to do one by one.

    Thanks for your work

    • This topic was modified 1 year, 5 months ago by cantoute.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cantoute

    (@cantoute)

    Here a snippet of how I did it, adding it somewhere like single-post.php I let the crawlers do the job ??

    <?php
    
    $pod = pods('post', get_the_ID());
    
    $fields = $pod->fields();
    $r = [];
    foreach ($fields as $k => $v) {
      $type = $pod->fields($k, 'pick_object');
      if (
        $type === 'post_type'
      ) {
        $ids = $pod->field($k . '.ID');
        $r[$k] = $ids;
      }
    }
    
    $pod->save($r);

    Here Pods reads the relations from dedicated table (if you configured pods to use a table) and when it saves, it creates/syncs the matching post meta.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @cantoute

    Thanks for sharing! This is similar to how I would approach this.

    Cheers, Jory

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is there a way to sync table based and meta based storage?’ is closed to new replies.