PetMatchPro reads a small set of optional define() constants from wp-config.php. These are operator-only kill switches, rollback toggles, and debugging hooks – none are required for normal plugin operation.
Use these when you need a site-wide effect that does not require a theme or mu-plugin file edit, or when you want a configuration to survive theme switches and plugin updates.
How to Add a Constant #
Open wp-config.php at the root of your WordPress install. Add the define() line above this comment block:
/* That's all, stop editing! Happy publishing. */
Adding constants below that line is supported by WordPress but conventionally avoided. Adding them above is the safe location.
Important: add_filter() and other WordPress functions are not available in wp-config.php because the file runs before WordPress core loads. Calling add_filter() there produces a fatal error and a 500 page. Use define() for the constants on this page; use add_filter() in your theme’s functions.php or in an mu-plugin file.
Constant Reference #
PMP_ANALYTICS_LEGACY_READS #
Since: 8.9.6
Type: boolean
Default: not defined (uses 8.9.4+ daily-table reads)
When defined and truthy, three dashboard read methods that were migrated to the daily summary table in 8.9.4 fall back to their pre-8.9.4 raw-events implementation:
getTotalEvents()/getTotalEventCount()– revertsSUM(event_count) FROM dailytoCOUNT(*) FROM eventsgetAnimalsNeedingAttention()– the Insights “Animals Needing Attention” panelgetStaleListings()– the Insights “Declining Click Rates” panel
Use as a one-line rollback if a migrated widget shows surprising numbers and you want to compare against the legacy implementation while the issue is investigated. Reverts on the next request – no plugin downgrade or restart needed.
// wp-config.php
define( 'PMP_ANALYTICS_LEGACY_READS', true );
Equivalent filter (use this if you cannot edit wp-config.php):
// theme functions.php or wp-content/mu-plugins/pmp-legacy.php
add_filter( 'pmp_analytics_legacy_reads', '__return_true' );
The constant takes precedence over the filter when both are set.
To turn the rollback off, either remove the define() line or change the value to false.
PMP_PROFILE #
Since: 8.26.0
Type: boolean (strict – must be exactly true)
Default: not defined (profiler off)
Turns on the lightweight request profiler, which writes coarse server-side timing lines to the PHP error log so a slow search render can be diagnosed on a live site without a custom build. It is one of three conditions that must all be met before a single line is logged: the constant is true, the current user can manage_options, and the URL carries ?pmp_profile=1. A logged-out visitor adding the query string never triggers any logging, and the rendered HTML is byte-identical whether the profiler is active or not.
// wp-config.php
define( 'PMP_PROFILE', true );
There is no equivalent filter – requiring a wp-config.php edit keeps the profiler hard to turn on by accident. To turn the profiler off, remove the define() line. See Performance Profiler for how to run it and read the output.
PMP_CARD_DATA_ALL #
Since: 8.26.0
Type: boolean (strict – must be exactly true)
Default: not defined (trimmed card attributes)
Restores the pre-8.26.0 behavior of emitting every non-empty API field as a data-* attribute on each search card. As of 8.26.0 each card emits only the attributes PetMatchPro’s own filter, sort, and date-sort controls actually read, which trims page weight and server render time on large listing pages. Define this constant if a theme or custom script you maintain reads a card field attribute that is no longer present, as a one-line rollback while you migrate that script.
// wp-config.php
define( 'PMP_CARD_DATA_ALL', true );
Reverts on the next request – no plugin downgrade or restart needed. To return to the trimmed output, remove the define() line.
Adding Future Constants #
This page is the canonical reference for plugin constants. When PetMatchPro adds a new define() hook in a future release, the constant appears here with its full description, expected type, default behavior, and a code example. The same constant is also summarized in the plugin’s readme.txt “Configuration Constants” FAQ section that ships with every release.
Related #
- Performance Profiler – running the profiler and reading its output
- Analytics Queue and WP-Cron Issues – cron-side diagnostics
- Performance and Caching Best Practices – related plugin-side caching toggles
- Contact Support – if a constant does not have the expected effect