post_author ); } /** * Schedules Activities for attachment transitions. * * @param int $post_id Attachment ID. */ public static function transition_attachment_status( $post_id ) { if ( \defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { return; } if ( ! \post_type_supports( 'attachment', 'activitypub' ) ) { return; } $post = \get_post( $post_id ); switch ( \current_action() ) { case 'add_attachment': // Add the post to the outbox. add_to_outbox( $post, 'Create', $post->post_author ); break; case 'edit_attachment': // Update the post to the outbox. add_to_outbox( $post, 'Update', $post->post_author ); break; case 'delete_attachment': // Delete the post from the outbox. add_to_outbox( $post, 'Delete', $post->post_author ); break; } } }