I need to move all playa relationships to EE relationships.

What is the best way to do this? I have not been able to find anything online explaining a process or how to approach this.

All I know is I don't want to just change the field type.

  • 1
    Do you have any Playa relationships which were made inside of Matrix fields? Commented Apr 24, 2014 at 12:10
  • @DerekHogue No, the Playa relationships are separate.
    – zizther
    Commented Apr 24, 2014 at 17:08

1 Answer 1


It's a pretty simple operation, since they are stored very similarly.

First, backup your database. Then, run this code in a PHP-enabled template:


$playa = ee()->db->query("SELECT * FROM exp_playa_relationships");
foreach($playa->result_array() as $rel)
    $data = array(
        'parent_id' => $rel['parent_entry_id'],
        'child_id' => $rel['child_entry_id'],
        'field_id' => $rel['parent_field_id'],
        'order' => $rel['rel_order']
        ee()->db->insert_string('exp_relationships', $data)


Then, change your Playa fields to Relationships fields. Done.

  • Much simpler than I would have thought. Thanks @DerekHogue
    – zizther
    Commented Apr 25, 2014 at 20:21
  • Thanks from me also @derek-hogue for this simple solution! Question: Does this also work for EE3?
    – BNetz
    Commented Jul 17, 2016 at 10:57
  • 1
    Yup, it should. Commented Jul 18, 2016 at 0:54
  • I just tried it with an EE2-install, and it works perfectly - thanks again!
    – BNetz
    Commented Jul 18, 2016 at 21:03
  • 1
    This PHP script worked perfectly with EE 2.11.9. Had a channel with a Playa channel field associated with a Zoo Visitor member. The channel had about 2,500 entries. After using this PHP script, loading a single channel entry on the EE admin panel went from being 50 seconds to 2 seconds. Commented Nov 13, 2017 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.