Keep PODS data (meta table) after wp-ultimo (multisite) template switching


I have a multisite install and using wp-ultimo to manage the subsite duplication, or “template sites” as they call it.

One downside to this approach is that you’d lose any edits you make when you switch the template, because in reality, it’s not a template, it’s an entire subsite that will override your current subsite.

I have extended the site’s pages with PODS, added a couple of simple text fields, they’re basically custom meta fields, you get the data using get_post_meta($id, 'field_name', true).

What I’m trying to achieve is:

  1. Write a function that will retrieve this data before duplication
  2. Pass the data to the search & replace filter that fires after duplication

Relevant Available Hooks:

  • do_action (../inc/duplicate/duplicate.php line 139) ( ‘mucd_before_copy_data’, $from_site_id, $to_site_id );

  • apply_filters (../inc/class-wu-site-hooks.php line 576) (‘wu_search_and_replace_on_duplication’, $search_and_replace_settings, $from_site_id, $to_site_id);

Using search & replace filter example

I don’t know enough PHP to wrap the function properly and pass the values, I’d appreciate any help or a nudge in the right direction.

Thank you <3

, , , Amgad Husein 3 years 2020-05-29T02:12:09-05:00 0 Answers 92 views 1

Leave an answer