Developer Reference

  • JNext lesson
  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Filter: dmyip_core_filters

Since: 1.7.1
Hook timing: Runs on init (after theme functions.php loads, so themes can filter it)

This developer reference documents the plugin’s filters, with dmyip_core_filters as the headline: introduced in 1.7.2, it controls which WordPress core filters process shortcodes, so themes can disable title or excerpt processing without losing content rendering.

Controls which WordPress hooks the plugin attaches do_shortcode to. Allows themes and plugins to selectively disable shortcode processing in titles, excerpts, and archive titles.

Default value:

[
    'the_title'             => true,
    'single_post_title'     => true,
    'wp_title'              => true,
    'the_excerpt'           => true,
    'get_the_excerpt'       => true,
    'get_the_archive_title' => true,
]

Disable all core filters

Shortcodes will still work in post content and Gutenberg blocks. Only title/excerpt/archive title processing is disabled.

add_filter( 'dmyip_core_filters', '__return_empty_array' );

Disable specific filters

add_filter( 'dmyip_core_filters', function ( $filters ) {
    $filters['the_title'] = false;
    $filters['the_excerpt'] = false;
    return $filters;
} );

Disable only in admin

Useful if shortcodes in titles cause issues in the admin post list but should render on the frontend.

add_filter( 'dmyip_core_filters', function ( $filters ) {
    if ( is_admin() ) {
        $filters['the_title'] = false;
    }
    return $filters;
} );

Disable everywhere except post content

add_filter( 'dmyip_core_filters', '__return_empty_array' );

This is the cleanest approach. Post content runs through the_content which always processes shortcodes via WordPress core. The dmyip_core_filters hook only controls the additional hooks the plugin adds.

Return false to disable all

Returning a non-array value disables all filters (the plugin has an is_array() guard):

add_filter( 'dmyip_core_filters', '__return_false' );

Filter: strip_shortcodes_tagnames

The plugin hooks into strip_shortcodes_tagnames to prevent its shortcodes from being removed by WordPress’s strip_shortcodes() function.

This ensures shortcodes like [year] and [month] remain intact in excerpts and other contexts where WordPress strips shortcodes by default.

Protected tags: year, month, cmonth, mon, cmon, mm, mn, nmonth, cnmonth, pmonth, cpmonth, nmon, cnmon, pmon, cpmon, date, monthyear, nmonthyear, pmonthyear, nyear, nnyear, pyear, ppyear, dt, nd, pd, weekday, wd, blackfriday, cybermonday, daysuntil, dayssince, datepublished, datemodified, age, season


Using Shortcodes in PHP

// Basic usage in theme templates
echo do_shortcode( '[year]' );
echo do_shortcode( '[month] [year]' );
echo do_shortcode( '[age date="1990-05-15" format="ym"]' );

// In dynamic strings
$copyright = do_shortcode( 'Copyright [year] My Company' );

// Conditional logic based on output
$days = (int) do_shortcode( '[daysuntil date="2026-12-25"]' );
if ( $days <= 30 ) {
    echo 'Christmas is coming!';
}

Using Shortcodes in ACF Fields

The plugin does not process shortcodes in ACF fields by default (security consideration). Enable selectively:

// By field type - all text fields
add_filter( 'acf/format_value/type=text', 'do_shortcode' );

// By field name
add_filter( 'acf/format_value/name=headline', 'do_shortcode' );

// By field key
add_filter( 'acf/format_value/key=field_abc123', 'do_shortcode' );

// Textarea fields
add_filter( 'acf/format_value/type=textarea', 'do_shortcode' );

// WYSIWYG fields
add_filter( 'acf/format_value/type=wysiwyg', 'do_shortcode' );

REST API from JavaScript

// Fetch all dates
const response = await fetch('/wp-json/dmyip/v1/dates');
const dates = await response.json();
console.log(dates.year.current); // "2026"

// Fetch a specific date
const age = await fetch('/wp-json/dmyip/v1/date/age?date=1990-05-15');
const data = await age.json();
console.log(data.value); // "35"

See REST API for full endpoint documentation.


Plugin Constants

  • DYNAMIC_MONTH_YEAR_INTO_POSTS_VERSION: '1.7.4' → Plugin version
  • DMYIP_PLUGIN_FILE: __FILE__ → Main plugin file path
  • DMYIP_PLUGIN_DIR: plugin_dir_path() → Plugin directory path
  • DMYIP_PLUGIN_URL: plugin_dir_url() → Plugin directory URL

Namespaces and Classes

Namespace: DMYIP\

  • DMYIP\Plugin: Bootstrap, singleton, registers all components
  • DMYIP\Shortcodes\Year: Year shortcodes
  • DMYIP\Shortcodes\Month: Month shortcodes
  • DMYIP\Shortcodes\Day: Day shortcodes
  • DMYIP\Shortcodes\Date: Combined date shortcodes
  • DMYIP\Shortcodes\PostDate: Published/modified date shortcodes
  • DMYIP\Shortcodes\Events: Black Friday/Cyber Monday
  • DMYIP\Shortcodes\Countdown: Days until/since, age calculation
  • DMYIP\Shortcodes\Season: Season shortcodes
  • DMYIP\Shortcodes\CoreFilters: WordPress hook integration
  • DMYIP\BlockEditor\Assets: Editor script/style enqueue
  • DMYIP\BlockEditor\Patterns: Block pattern registration
  • DMYIP\BlockEditor\DynamicDateBlock: Dynamic Date block registration
  • DMYIP\BlockEditor\BlockBindings: Block Bindings API (WP 6.5+)
  • DMYIP\REST\DatesEndpoint: REST API endpoints
  • DMYIP\CLI\Commands: WP-CLI commands
  • DMYIP\Integrations\RankMath: Rank Math filters
  • DMYIP\Integrations\Yoast: Yoast SEO filters
  • DMYIP\Integrations\SEOPress: SEOPress filters
  • DMYIP\Integrations\Elementor: Elementor widget filter
  • DMYIP\Integrations\RelatedPosts: CRP title filter

Localized Script Data

The plugin passes dmyipData to the editor script:

window.dmyipData = {
    currentYear: "2026",
    currentMonth: "February",
    currentDate: "February 18, 2026"
};

Used by the toolbar dropdown for live preview values.

Quick answers to common questions:

How do I stop shortcode processing in titles only?

Filter dmyip_core_filters and remove the title entries from the array; content and excerpt processing continue untouched. It runs on init after the theme loads, so a theme’s functions.php can register the filter normally.

Can I add my own dynamic shortcode alongside the plugin’s?

Yes, register your shortcode normally and it benefits from the same core-filter processing the plugin enables. For SEO-field rendering, reuse the plugin’s integration hooks documented here rather than re-implementing them.