Skip to content

Commit

Permalink
Merge pull request #7671 from Automattic/fix/email-url-issue
Browse files Browse the repository at this point in the history
Fix incorrect URLs for edited emails
  • Loading branch information
donnapep committed Aug 22, 2024
2 parents d2ee44e + 3d52670 commit 397e099
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog/fix-email-url-issue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect URL for edited emails
3 changes: 2 additions & 1 deletion includes/internal/emails/class-email-sender.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ public function get_email_body( WP_Post $email_post, array $placeholders = [] ):
*/
private function replace_placeholders( string $content, array $placeholders ): string {
foreach ( $placeholders as $placeholder => $value ) {
$content = str_replace( '[' . $placeholder . ']', $value, $content );
// Strip out URL protocol if necessary. Partial solution for https://github.com/Automattic/sensei/issues/7621.
$content = preg_replace( '~(https?://)?\[' . $placeholder . '\]~', $value, $content );
}

return $content;
Expand Down

0 comments on commit 397e099

Please sign in to comment.