Skip to content

mastodon_api_submit_post_data

github-actions[bot] edited this page May 15, 2026 · 1 revision

Allow modifying the post data before it gets inserted or updated.

Auto-generated Example

add_filter(
    'mastodon_api_submit_post_data',
    function (
        array $post_data,
        string $status_text,
        int|string $in_reply_to_id = null,
        array $media_ids,
        string $post_format,
        string $visibility,
        string $scheduled_at = null,
        int $post_id = null,
        Enable_Mastodon_Apps\Mastodon_App $app
    ) {
        // Your code here
        return $post_data;
    },
    10,
    9
);

Parameters

  • array $post_data The post data for wp_insert_post() or wp_update_post().
  • string $status_text The user submitted status text after filtering.
  • int|string|null $in_reply_to_id The ID of the status to reply to.
  • array $media_ids The media attachment IDs.
  • string $post_format The post format to create.
  • string $visibility The requested status visibility.
  • string|null $scheduled_at The scheduled post date.
  • int|null $post_id The post ID when updating.
  • Enable_Mastodon_Apps\Mastodon_App $app The app creating or updating the post.

Returns

array The potentially modified post data.

Files

apply_filters( 'mastodon_api_submit_post_data', $post_data, $status_text, $in_reply_to_id, $media_ids, $post_format, $visibility, $scheduled_at, $post_id, $app )

Hooks

Clone this wiki locally