wp-config.php Configuration Constants #
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.
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 #
- 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