Skip to content

Statuses

Functions for working with listing statuses.

See the Listing_Status object reference for all methods available on the returned object.


Functions

dms_get_status( int $status_id ): Listing_Status

Retrieves a single listing status object by its ID.

Parameters

Name Type Default Description
$status_id int - The status ID

Returns - Listing_Status

Example

$status = dms_get_status( 2 );

echo esc_html( $status->get( 'name' ) );
echo esc_html( $status->get( 'color' ) );

if ( $status->is_required() ) {
    // Built-in status - cannot be deleted
}

Note: The current listing status is also accessible directly via the Listing object.

$listing = dms_get_listing( 42 );
$status_slug = $listing->get_status(); // e.g. 'active', 'sold', 'sale_pending'

$listing->set_status( 'sold' );