Answers.Body: <p>If you want to also edit any draft emails that use Mosaico, you also need to run this query:</p>
  <pre><code>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';
  </code></pre>
  <p>In my example, note that I have a absolute path in my templates (not sure if this is always the case).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-07T15:08:51.450Z
Answers.LastActivityDate: 2021-07-07T15:08:51.450Z
Answers.UserDisplayName: A. Block
Answers.Body: <p>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.</p>
  <p>You can run below query to update the path from <code>sites/default/files/civicrm/ext/</code> to <code>wp-content/civicrm_extensions/</code></p>
  <pre><code>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/‘);
  </code></pre>
  <p>HTH</p>
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T20:13:30.183Z
Answers.Text: Thank you, that worked i needed to update civicrm_mosaico_template table.
Answers.UserDisplayName: FullStack-Dev
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-31T14:17:48.697Z
Answers.LastActivityDate: 2021-03-31T14:17:48.697Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>There is now an API to simplify this process and make it accessible to folks who aren't comfortable modifying the database directly.</p>
  <p><code>MosaicoTemplate.replaceurls</code> is the API.  <a href="https://docs.civicrm.org/mosaico/en/latest/api/#apiv3" rel="nofollow noreferrer">Full documentation</a> is available, but if you aren't comfortable with the command line:</p>
  <ul>
  <li>Go to <strong>Support menu » Developer » API Explorer v3</strong> (see screenshot below).</li>
  <li>For <em>Entity</em> choose <strong>MosaicoTemplate</strong>.  For <em>Action</em> choose <strong>replaceurls</strong>.</li>
  <li>Set <em>Base URL of the server where the templates were generated</em> to the old URL you want to change.</li>
  <li>Click <strong>Add Parameter</strong> to add a second line.  Set it to <strong>Base URL of the current server</strong> equals the new URL.</li>
  <li>Press the <strong>Execute</strong> button at the bottom of the page.</li>
  </ul>
  <p><a href="https://i.sstatic.net/WxG0W.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WxG0W.png" alt="API Explorer screenshot demonstrating Mosaicotemplate.replaceurls" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-24T16:40:52.143Z
Answers.LastActivityDate: 2022-05-24T16:40:52.143Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>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.</p>
  <p>Checked the Resource URL, Directories settings everything seems to be correct. Also cleared CiviCRM cache and delete template_c with no success.</p>
  <p>Any pointers would be appricated</p>
  <p>Thank you</p>
  
Tags: <mosaico>
Title: Can't edit mosaico templates any more
ThreadText: # Can't edit mosaico templates any more
  
  (Asked by: username_0 on 2021-03-31)
  
  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
  
  **Tags:** mosaico
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2021-07-07. Score: 3
  
  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).
  
  
  ---
  
  ### Answer by username_2 on 2021-03-31. Score: 2
  
  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/‘);
  
  ```
  
  HTH
  
  username_2
  
  > **Comments:**
  > **username_0**: Thank you, that worked i needed to update civicrm_mosaico_template table.  
  
  ---
  
  ### Answer by username_3 on 2022-05-24. Score: 2
  
  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](https://docs.civicrm.org/mosaico/en/latest/api/#apiv3) 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](https://i.sstatic.net/WxG0W.png)](https://i.sstatic.net/WxG0W.png)
  
  
  ---
  
  