From ba3f213d627ab3019a162ba73deaf8b60e991c4d Mon Sep 17 00:00:00 2001
From: Benjamin Pahl <8275915+DasBen@users.noreply.github.com>
Date: Tue, 29 Mar 2022 19:08:53 +0200
Subject: [PATCH] Non existing figcaption was not supported
---
casualben-automatic-alt-and-caption-text.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/casualben-automatic-alt-and-caption-text.php b/casualben-automatic-alt-and-caption-text.php
index d0ace72..140d36b 100644
--- a/casualben-automatic-alt-and-caption-text.php
+++ b/casualben-automatic-alt-and-caption-text.php
@@ -3,7 +3,7 @@
* Plugin Name: CasualBen Automatic Alt and Caption Text
* Plugin URI: https://github.com/DasBen/CasualBen-Automatic-Alt-And-Caption-Text
* Description: Automatically adds alt text and captions to images in Gutenberg block editor when you add or modify in the Media Library
- * Version: 1.1.0
+ * Version: 1.1.1
* Author: Benjamin Pahl - CasualBen
* Author URI: https://www.casual-ben.com
*
@@ -30,6 +30,8 @@
// Update Caption
$caption = wp_get_attachment_caption($block['attrs']['id']);
if (!empty($caption)) {
+ $content = str_replace("", "".$caption."", $content);
+ } else {
$content = preg_replace('/.*<\/figcaption>/', '' . $caption . '', $content);
}
}