Skip to main content

benecaster_sponsor_manager_before_archive_sponsor

Action Premium sponsor-manager

Fires before a sponsor is archived or restored on the Sponsors screen, or through POST /benecaster-sponsor-manager/v1/sponsors/{id}/archive or …/restore. Archiving hides the sponsor on every show, in the lists and the episode pickers, and deletes nothing: episodes it is already on keep it.

Parameters

Name Type Default Description
$sponsor_id int — The sponsor
$archived bool — `true` when it is being archived, `false` when restored

Example

add_action( 'benecaster_sponsor_manager_before_archive_sponsor', function ( int $sponsor_id, bool $archived ): void {
    my_audit_log( $archived ? 'sponsor-archiving' : 'sponsor-restoring', $sponsor_id );
}, 10, 2 );

Notes

Asking for the state the sponsor already has writes nothing and fires nothing. Walkthrough: Read, create, change, archive or restore the site's sponsors and a show's sponsor campaigns from code, as the Sponsors screen does.

Affects

  • Benecaster → Sponsors
  • POST benecaster-sponsor-manager/v1/sponsors/{id}/archive
  • POST benecaster-sponsor-manager/v1/sponsors/{id}/restore

Need this built rather than just documented? See our services →