Skip to content

Actions Reference (Developers)

Actions let you run code at a specific moment. Register a callback with add_action( 'hook_name', 'your_callback', 10, N ). Actions don't return a value.

This is a curated reference of the load-bearing action hooks. Parameter order below is taken directly from the source call sites.

add_action( 'dms_on_listing_save', function ( $listing_id, $post, $update ) {
    // trigger custom action on a saved listing
}, 10, 3 );

Boot Phases

See Getting Started for the load-order hooks dms_before_init, dms_init, dms_after_init, and dms_init_extension.

Front-end render hooks

Fired while templates render - use to inject markup around listings and page regions.

Action Fires
dms_before_header / dms_after_header Around the DMS page header
dms_before_single_listing / dms_after_single_listing Around a single listing card (SRP)
dms_before_single_listing_inner Inside a single listing card
dms_before_sri / dms_after_sri Around a single result item - Listing $listing, array $listing_classes
dms_inner_before_sri / dms_inner_after_sri Inside a result item - Listing $listing, array $listing_classes
dms_before_no_listings_found / dms_after_no_listings_found Around the no-results block
dms_srp_inside_listings_container Inside the SRP listings container
dms_before_tab_content / dms_after_tab_content Around VDP tab content - mixed $arg
dms_srp_footer / dms_vdp_footer SRP / VDP footer
dms_enqueue_scripts, dms_srp_enqueue_scripts, dms_vdp_enqueue_scripts, dms_comparison_enqueue_scripts Script/style enqueue points per context
add_action( 'dms_after_sri', function ( $listing, $classes ) {
    if ( $listing->is_sold() ) {
        echo '<span class="sold-flag">Sold</span>';
    }
}, 10, 2 );

Listing Lifecycle

dms_on_listing_save

Fires after a listing is saved (manual edit, import, or programmatic). The main hook for reacting to listing changes.

  • Params: int $listing_id, WP_Post $post, bool $update
add_action( 'dms_on_listing_save', function ( $listing_id, $post, $update ) {
    $listing = dms_get_listing( $listing_id );
    // e.g. push to an external feed
}, 10, 3 );

dms_delete_post

Fires when a listing is deleted.

  • Params: int $post_id, WP_Post $post

dms_updated_term

Fires when a listing's stored category term value is updated.

  • Params: int $category_id, int $term_id, mixed $value

Status Lifecycle

dms_listing_status_changed

Fires when a listing's status changes.

  • Params: string $new_status, string $old_status, int $listing_id
add_action( 'dms_listing_status_changed', function ( $new, $old, $listing_id ) {
    if ( $new === 'sold' ) {
        // notify accounting
    }
}, 10, 3 );

dms_execute_status_action

Fires when a configured status action runs.

  • Params: string $action, Listing $listing, string $new_status, string $old_status

dms_added_new_status

Fires when a new status is created. Params: int $status_id.


Type / Category / Term / Badge Lifecycle

Each object type follows the same added / before_update / after_update / before_delete / after_delete pattern.

Object Added Before / After Update Before / After Delete
Type dms_added_new_type (int $type_id) dms_before_update_type / dms_after_update_type (Type $type, array $form_data) dms_before_delete_type (int $id) / dms_after_delete_type (int $id, bool $was_deleted)
Category dms_added_new_category (int $id) dms_before_update_category / dms_after_update_category (Category $category, array $post) dms_before_delete_category (int $id) / dms_after_delete_category (int $id, bool $was_deleted)
Term dms_added_new_term (int $id) dms_before_update_term / dms_after_update_term (Term $term, array $form_data) dms_before_delete_term (int $id) / dms_after_delete_term (int $id, bool $was_deleted)
Badge dms_added_new_badge (int $badge_id) dms_before_update_badge / dms_after_update_badge (Badge $badge, array $form_data) dms_before_delete_badge (int $id) / dms_after_delete_badge (int $id, bool $was_deleted)

Status uses dms_added_new_status plus dms_before_delete_listing_status / dms_after_delete_listing_status; status changes go through dms_listing_status_changed above rather than an update event.


Leads & Forms

dms_add_lead

Fires when a lead is captured.

  • Params: array $lead_data, int $listing_id, array $form_data

dms_lead_assigned

Fires when a lead is assigned to a user.

  • Params: Lead $lead, int $assigned_user_id

dms_before_mail_send

Fires just before a form notification email is sent - inspect/short-circuit the send.

  • Params: array $mail_data

dms_form_submit_success

Fires after a successful form submission.

  • Params: int $form_id, WP_Post $post, array $submission_data
add_action( 'dms_add_lead', function ( $lead_data, $listing_id, $form_data ) {
    // sync new lead to an external CRM
}, 10, 3 );

Import / Export

Import and export fire paired before/after hooks around each screen section and around the run itself. The most useful for integrations:

Action Params Fires
dms_before_import / dms_after_import Import $import Around a whole import run
dms_before_single_import Import $import Before each listing in the import is processed
dms_after_single_import Listing $listing, Import $import, Import $importer, bool $is_update After each listing is imported ($is_update distinguishes new vs. updated)
dms_import_before_finish / dms_import_after_finish array $data Around import completion
dms_export_before_finish / dms_export_after_finish array $data Around export completion
// Post-process each listing as it is imported.
add_action( 'dms_after_single_import', function ( $listing, $import, $importer, $is_update ) {
    if ( ! $is_update ) {
        // e.g. tag brand-new imported listings
    }
}, 10, 4 );

dms_after_single_import is the dedicated per-listing import hook. dms_on_listing_save also fires per listing during import, but runs on every save site-wide.

The full set of dms_import_* / dms_export_* before_/after_ section hooks (settings, filters, options, presets, CSV/XML options, download details) exists for injecting fields into those admin screens - grep do_action( 'dms_export_ / dms_import_ for the complete list.


Stock Alerts

dms_stock_alert_created

Fires when a shopper signs up for a stock alert.

  • Params: int $alert_id, int $type_id, array $criteria, int $contact_id

dms_stock_alert_fulfilled

Fires when a matching listing arrives and the alert is fulfilled.

  • Params: int $alert_id, int $listing_id, object $alert

Extensions

dms_init_extension

Extension entry point - fires on plugins_loaded. See Building Extensions.


See also