Skip to main content

benecaster_add_episode_note()

Episode Free
benecaster_add_episode_note( int $episode_id, string $content, string $note_type = 'internal' ): int|WP_Error

Adds a production note to an episode. Production notes are the working record attached to an episode — why it slipped, what still needs doing, what a guest asked to have cut — and they are never published.

Use this from an add-on when your own workflow produces something the podcaster should see next to the episode itself, rather than in a log they will never open.

Pass 'system' for anything written by code. System notes are stored without an author, which is how the editor tells them apart from notes a person typed, and is what stops automated output from appearing to be somebody’s words.

Parameters

Name Type Default Required Description
$episode_id int Yes WordPress post ID of the episode the note belongs to.
$content string Yes Plain text content of the note. Not rendered as markdown or HTML — production notes are working text, not published copy.
$note_type string 'internal' No 'internal' for a note attributed to the current user, or 'system' for one generated by code. A system note is stored with no author.

Return Value

Type: int|WP_Error

The ID of the new note, or a WP_Error if the episode does not exist or the content is empty.

Example

// Record why an episode was held back, from an add-on's own workflow.
$note_id = benecaster_add_episode_note(
    $episode_id,
    'Held for legal review — flagged by compliance add-on.',
    'system'
);

if ( is_wp_error( $note_id ) ) {
    // The episode was deleted, or the note was empty.
}

Hooks Fired

Notes

Firing order matters if you also listen for the note: benecaster_episode_note_added fires immediately after the note is stored, including for notes added this way. A callback on that action that calls this function again will recurse — guard on $note_type if your listener writes notes of its own.

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