handling fixing empty anchor

This commit is contained in:
Antoine M 2024-07-03 10:22:28 +02:00
parent e0b2e362e3
commit 915f0aca68
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
$relatedPostId = $attributes['relatedPostId'] ?? null; $relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId); $relatedPost = get_post($relatedPostId);
$anchor = isset($attributes['anchor']) ? esc_html($attributes['anchor']) : "post-content-container-" . $relatedPostId; $anchor = !empty($attributes['anchor']) ? esc_html($attributes['anchor']) : "post-content-container-" . $attributes['relatedPostId'];
$content = get_the_content(null, null, $relatedPost); $content = get_the_content(null, null, $relatedPost);

View File

@ -1,7 +1,7 @@
<?php <?php
$relatedPostId = $attributes['relatedPostId'] ?? null; $relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId); $relatedPost = get_post($relatedPostId);
$anchor = isset($attributes['anchor']) ? esc_html($attributes['anchor']) : "post-content-container-" . $relatedPostId; $anchor = !empty($attributes['anchor']) ? esc_html($attributes['anchor']) : "post-content-container-" . $attributes['relatedPostId'];
$content = get_the_content(null, null, $relatedPost); $content = get_the_content(null, null, $relatedPost);