Recently we migrated our site from Drupal to Wordpress, everything seems to be working fine however we can't edit mosaico templates we had created while we were on Drupal. Have bunch of JS errors on browser console, seems its trying to load template from oldsite.

Checked the Resource URL, Directories settings everything seems to be correct. Also cleared CiviCRM cache and delete template_c with no success.

Any pointers would be appricated

Thank you

3 Answers 3


Mosaico extension stores path in civicrm_mosaico_template and civicrm_mosaico_msg_template table. When mosaico extension code is moved you will need to update path in these tables to new path.

You can run below query to update the path from sites/default/files/civicrm/ext/ to wp-content/civicrm_extensions/

UPDATE civicrm_mosaico_template 
SET metadata = REPLACE(metadata, 'sites/default/files/civicrm/ext/', 'wp-content/civicrm_extensions/‘);

UPDATE civicrm_mosaico_msg_template 
SET metadata = REPLACE(metadata, 'sites/default/files/civicrm/ext/', 'wp-content/civicrm_extensions/‘);



  • Thank you, that worked i needed to update civicrm_mosaico_template table. Mar 31, 2021 at 20:13

If you want to also edit any draft emails that use Mosaico, you also need to run this query:

UPDATE civicrm_mailing SET template_options = REPLACE(template_options, 'https:\\/\\/proddomain.ext\\/media\\/civicrm\\/ext\\', 'https:\\/\\/devdomain.ext\\/media\\/civicrm\\/ext\\') WHERE template_type = 'mosaico';

In my example, note that I have a absolute path in my templates (not sure if this is always the case).


There is now an API to simplify this process and make it accessible to folks who aren't comfortable modifying the database directly.

MosaicoTemplate.replaceurls is the API. Full documentation is available, but if you aren't comfortable with the command line:

  • Go to Support menu » Developer » API Explorer v3 (see screenshot below).
  • For Entity choose MosaicoTemplate. For Action choose replaceurls.
  • Set Base URL of the server where the templates were generated to the old URL you want to change.
  • Click Add Parameter to add a second line. Set it to Base URL of the current server equals the new URL.
  • Press the Execute button at the bottom of the page.

API Explorer screenshot demonstrating Mosaicotemplate.replaceurls

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.