fix: link targets never reveal library entries by type (ruling Q14)

WpLinkTargets answers the library, internal "_" types and every type
without a Divi post_link_url option like a missing ID; replace-text strips
library IDs only from global subtrees.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 15:13:40 +02:00
co-authored by Claude Opus 5.5
parent c7ce924e5a
commit 82ef69a99c
7 changed files with 154 additions and 19 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi\Pages;
use LIT\MCP\Integrations\Divi\Compose\LinkTargets;
use LIT\MCP\Integrations\Divi\Compose\ValueSanitizer;
defined('ABSPATH') || exit;
@@ -19,6 +20,11 @@ defined('ABSPATH') || exit;
*/
final class WpValueSanitizer implements ValueSanitizer
{
/** @param LinkTargets $links The {{link:}} targets post_link_url_* follow too (ruling P10). */
public function __construct(private LinkTargets $links = new WpLinkTargets())
{
}
public function text(string $value): string
{
return sanitize_text_field($value);
@@ -51,6 +57,6 @@ final class WpValueSanitizer implements ValueSanitizer
public function linkTargetType(int $id): ?string
{
return (new WpLinkTargets())->postTypeOf($id);
return $this->links->postTypeOf($id);
}
}