Issue Bug New Orphaned Good first issue

#98362AbstractMetaTagManager: $replace is useless on metatags with "allowMultipleOccurrences" set

Alexander Köberl 09/16/22, 09:51 updated 11/28/22, 12:23

Description

Tried to override metatags from page settings in a plugin on this page.
Failed on og:image, always both, the page og_image and the image from my plugin are rendered, even if $replace = true is set.

TYPO3 Versions 10 & 11

lines 117 and 150 in TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager
The code does not allow to replace metatags with “allowMultipleOccurrences” set

if ($replace === true) {
    $this->removeProperty($property, $type);
    $this->properties[$property][] = ['content' => $content, 'subProperties' => $subPropertiesArray];
    return;
}

if (isset($this->handledProperties[$property]['allowMultipleOccurrences']) &&
    (bool)$this->handledProperties[$property]['allowMultipleOccurrences']
) {
    $this->properties[$property][] = ['content' => $content, 'subProperties' => $subPropertiesArray];
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] AbstractMetaTagManager: $replace is useless on metatags with "allowMultipleOccurrences" set Resolves: #98362 Releases: main