Filters Reference (Developers)¶
Filters let you modify a value before DMS uses it. Register a callback with add_filter( 'hook_name', 'your_callback', 10, N ) and always return the (possibly modified) value.
This is a curated reference of the load-bearing filters, grouped by system. Parameter order below is taken directly from the source call sites. Filters not listed here exist but are internal/UI-field builders - search the pattern apply_filters( 'dms_ if you need one that isn't documented.
add_filter( 'dms_query_args', function ( $args ) {
$args['posts_per_page'] = 24;
return $args; // must return the value
} );
Listing Query¶
dms_query_args¶
Filter the full listing query args before the SRP query runs.
- Params:
array $query_args - Return:
array
add_filter( 'dms_query_args', function ( $args ) {
// Only show published listings updated in the last year.
$args['date_query'] = [ [ 'after' => '1 year ago', 'column' => 'post_modified' ] ];
return $args;
} );
dms_total_listings¶
Filter the reported total result count.
- Params:
int $count,Query $listing_query - Return:
int
dms_orderby_options¶
Filter the available "order by" options on the SRP.
- Params:
array $orderby_categories - Return:
array
dms_get_unique_listing_args¶
Filter args used to fetch a unique listing.
- Params:
array $args,mixed $value,Type $type
dms_ajax_listing_args¶
Filter the query args used when the SRP loads listings over AJAX (filtering, paging, infinite scroll).
- Params:
array $args - Return:
array
dms_ajax_filter_data¶
Filter the data payload returned to the front end after an AJAX filter request (result counts, term availability, etc.).
- Params:
array $ajax_data - Return:
array
dms_selected_terms¶
Filter the set of category terms currently selected as filters on the SRP.
- Params:
array $terms - Return:
array
Listing Display & Pricing¶
dms_listing_{price_type}price (dynamic)¶
Filter a listing's numeric price. {price_type} is empty for the base price, or original for the original price - e.g. dms_listing_price, dms_listing_originalprice.
- Params:
float $price,Listing $listing - Return:
float
// Add a flat $500 to every displayed base price.
add_filter( 'dms_listing_price', function ( $price, $listing ) {
return $price + 500;
}, 10, 2 );
dms_listing_formatted_{price_type}price (dynamic)¶
Filter the currency-formatted price string.
- Params:
string $formatted,int $listing_id - Return:
string
dms_listing_fees_discounts¶
Filter the resolved fee/discount line items for a listing.
- Params:
array $items,Listing $listing - Return:
array
dms_listing_selected_terms¶
Filter the selected term objects returned for a category on a listing.
- Params:
Term[] $terms,int $category_id,Listing $listing - Return:
Term[]
dms_listing_load_additional_meta¶
Filter the list of additional meta keys eagerly loaded with a listing.
- Params:
array $meta - Return:
array
dms_listing_next_link¶
Filter the next/previous listing navigation URL.
- Params:
string $url,Listing $listing
dms_single_listing_srp_classes¶
Filter the CSS classes on a single listing card in the SRP.
- Params:
array $listing_classes,Listing $listing - Return:
array
dms_get_listing_value_shortcode¶
Filter the output of [dms_get_listing_value].
- Params:
mixed $return,string $category,Listing $listing
SRP Layout¶
| Filter | Params | Purpose |
|---|---|---|
dms_srp_container_classes |
array |
SRP container CSS classes |
dms_srp_ul_classes |
array |
Listing <ul> classes |
dms_srp_column_classes |
array |
Per-column classes |
dms_srp_column_attrs |
array |
Per-column attributes |
dms_srp_inline_css |
string |
Inline CSS injected on the SRP |
dms_vdp_inline_css |
string |
Inline CSS injected on the VDP |
dms_pagination_next_arrow / dms_pagination_prev_arrow |
string |
Pagination arrow markup |
dms_after_filter_scroll_offset |
int (default 100) |
Scroll offset after filtering |
No Results / Stock Alerts¶
dms_no_results_content¶
Filter the fully resolved "no results" content (heading, message, CTA, notify-me form).
- Params:
array $content,Type $type,bool $infinite_scrolling - Return:
array
dms_no_results_fields¶
Filter the CMB2 field definitions for the No Results settings.
- Params:
array $fields,array $base_condition
dms_stock_alert_matches¶
Decide whether a listing matches a saved stock alert. The key extension point for custom matching logic.
- Params:
bool $matches,object $alert,Listing $listing - Return:
bool
add_filter( 'dms_stock_alert_matches', function ( $matches, $alert, $listing ) {
// Never match sold listings.
return $matches && ! $listing->is_sold();
}, 10, 3 );
Other stock-alert filters¶
| Filter | Params | Purpose |
|---|---|---|
dms_stock_alert_auto_notify |
bool |
Master toggle for automatic notification |
dms_stock_alert_listing_available |
bool $available, Listing $listing |
Whether a listing counts as "available" |
dms_stock_alert_email_content |
string $content, object $alert, Listing $listing |
Shopper notification email body |
dms_stock_alert_admin_content |
string $content, object $alert, int $type_id |
Admin notification body |
dms_stock_alert_admin_recipients |
array $recipients, int $alert_id, int $type_id |
Admin recipient list |
dms_stock_alert_confirmation_content |
string $content, object $alert, int $type_id |
Sign-up confirmation email |
dms_stock_alert_from_email / _from_name |
string, object $alert, Listing\|null |
Sender identity |
dms_stock_alert_batch_size |
int (default 50) |
Listings processed per batch |
dms_stock_alert_rate_limit / _rate_limit_window |
int |
Per-shopper submission rate limiting |
dms_stock_alert_send_confirmation |
bool, int $alert_id, int $type_id |
Toggle confirmation email |
Forms & Mail¶
The dms_form_mail_* filters all receive ( $value, int $form_id, WP_Post $post ) and let you override how a form submission is emailed. They apply to every DMS form (lead capture, contact, trade-in, etc.), not just lead forms; use $form_id to scope to a single form. They do not affect non-form emails (e.g. stock-alert notifications), which have their own hooks.
| Filter | Overrides |
|---|---|
dms_form_mail_to |
Recipient address |
dms_form_mail_subject |
Subject line |
dms_form_mail_from_name |
From name |
dms_form_mail_reply_to |
Reply-to address |
dms_form_mail_content |
Email body (fires for plaintext and ADF payloads) |
dms_form_mail_content_type |
Content type (default text/html) |
dms_form_mail_type |
Mail type/format |
dms_form_mail_adf_to / _adf_subject |
ADF (lead XML) recipient & subject |
dms_form_mail_success_message / _error_message |
Front-end result messages |
add_filter( 'dms_form_mail_to', function ( $to, $form_id, $post ) {
return 'sales@example.com';
}, 10, 3 );
dms_form_verify_captcha¶
Override captcha validation for a form field.
- Params:
bool $is_valid,string $field_id,array $field,WP_Post $post - Return:
bool
Badges¶
| Filter | Params | Purpose |
|---|---|---|
dms_badge_css |
string $css, Badge $badge, string $class |
Generated badge CSS |
dms_badge_template_rendered |
string $html, string $key, array $data |
Rendered badge markup |
dms_badge_position_options |
array |
Available badge positions |
dms_listing_badge_options |
array $fields |
Badge option fields |
SEO¶
dms_seo_share_tags¶
Filter the meta description and Open Graph / Twitter share tags printed on a listing page (VDP). Runs after the description is cut to 156 characters.
- Params:
array $tags(title,url,desc,image),Listing $listing - Return:
array. Return[]to print no tags (for example when another SEO plugin handles them).imageis a gallery image array; set it to[]to skip the og:image and twitter:image tags.
add_filter( 'dms_seo_share_tags', function ( array $tags, $listing ): array {
// Add a call to action to the description.
$tags['desc'] = rtrim( $tags['desc'], '. ' ) . '. Call us today!';
// Use a branded fallback image when the listing has none.
if ( empty( $tags['image']['src'] ) ) {
$tags['image'] = [ 'src' => get_site_icon_url( 1200 ) ];
}
return $tags;
}, 10, 2 );
Caching¶
| Filter | Params | Purpose |
|---|---|---|
dms_caching_enabled |
bool |
Master cache toggle |
dms_get_option_{name} (dynamic) |
mixed $return, string $name |
Filter a specific option's read value |
Frontend Assets¶
DMS loads its base assets (global.js, the framework stylesheet and dms-general.css) only on a page with DMS content: an SRP, VDP or comparison page, a page holding a DMS element or [dms_ shortcode, or any page when a header, footer or popup holds a DMS element. Every DMS element also loads them as it renders, so a page the check misses still works.
| Filter | Params | Purpose |
|---|---|---|
dms_load_base_assets |
bool $load |
Force the base assets on (__return_true, every page) or off for the current page |
dms_load_bulma |
bool |
Load the full Bulma build instead of the slim framework |
dms_frontend_scripts_in_footer |
bool $in_footer |
Default true. Frontend scripts registered with dms_register_script() or dms_enqueue_script() that do not pick a position load in the footer. Return false to put them back in the head |
Scripts that call the global DMS object must list dms-global as a dependency, otherwise they can run on a page where it is not loaded:
DMS scripts load in the footer, so they never block the first paint. That means they run after the page body has been parsed. Inline code that calls the DMS object has to wait for DOMContentLoaded (or jQuery(document).ready), or be attached to the script with wp_add_inline_script( 'dms-global', $js, 'after' ). Code that calls DMS.* while the page is still loading will find it undefined.
Stylesheets can depend on dms-frontend-framework (or the older dms-bulma alias) the same way. The handles are always registered, whether or not they are enqueued.
See also¶
- Actions Reference - hooks that run code on events (no return value).
- Cookbook - worked recipes combining these filters.