Skip to content

Instantly share code, notes, and snippets.

@lordmatt
Created July 30, 2026 12:48
Show Gist options
  • Select an option

  • Save lordmatt/d40fc009ea9fedd277b6d959d8081fc6 to your computer and use it in GitHub Desktop.

Select an option

Save lordmatt/d40fc009ea9fedd277b6d959d8081fc6 to your computer and use it in GitHub Desktop.
<?php
/**
* WordPress Post Extended Transformer Class file for the ActivityPub WordPress plugim.
*
* There is a massive problem with this approach. I just locked all other plugins out
* from ever doing something similar. The WordPress way is to supply a filter.
*/
namespace Activitypub\Transformer;
class MoreTags extends Post {
protected function get_tag() {
if ( false !== $this->tags ) {
return $this->tags;
}
$tags = parent::get_tag();
// I'm honestly surprised this was not in core
$tags = apply_filters( 'activitypub_post_tags', $tags, $this->item);
$this->tags = \array_unique( $tags, SORT_REGULAR );
return $this->tags;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment