fix(bridge): handle undefined term.description in strip_html
Now that _embed works correctly, WordPress returns full wp:term data where some categories have undefined description fields. Guard strip_html against null/undefined input. Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
1 parent
53f37b27b0
commit
563136ff00
1 file changed
+2
-1
@@ -12,7 +12,8 @@ import type {
|
||||
|
||||
const EMBED_VALUE = 'wp:featuredmedia,author,wp:term';
|
||||
|
||||
function strip_html(html: string): string {
|
||||
function strip_html(html: string | undefined | null): string {
|
||||
if (!html) return '';
|
||||
return html.replace(/<[^>]+>/g, '').replace(/&[a-z]+;/gi, ' ').trim();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user