feat(wpmc S5): TitleFilter hooks the_title + single_cat_title do_shortcode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vladimir Bryzgalov
2026-05-16 22:31:34 +05:00
parent a835ba3662
commit ca8a0a8b43
2 changed files with 44 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace WPMultiCity;
final class TitleFilter
{
public static function register(): void
{
\add_filter('the_title', 'do_shortcode', 9999);
\add_filter('single_cat_title', 'do_shortcode', 9999);
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace WPMultiCity\Tests;
use WPMultiCity\TitleFilter;
final class TitleFilterTest extends TestCase
{
public function test_register_attaches_the_title_do_shortcode_at_9999(): void
{
TitleFilter::register();
self::assertSame(
9999,
has_filter('the_title', 'do_shortcode'),
'TitleFilter::register() must hook the_title → do_shortcode at priority 9999'
);
}
public function test_register_attaches_single_cat_title_do_shortcode_at_9999(): void
{
TitleFilter::register();
self::assertSame(
9999,
has_filter('single_cat_title', 'do_shortcode'),
'TitleFilter::register() must hook single_cat_title → do_shortcode at priority 9999'
);
}
}