# Notice When Editing Someone Else's Post

> Reminds editors with a notice in the block editor when the post they opened was written by another author, to avoid unintended changes to a colleague's work.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: notices, editor, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/admin-notice-editing-others-post/

## Code

```php
add_action( 'enqueue_block_editor_assets', function () {
    $post = get_post();
    if ( ! $post || ! $post->post_author || (int) $post->post_author === get_current_user_id() || 'auto-draft' === $post->post_status ) {
        return;
    }

    $message = sprintf( 'You are editing a %s written by %s.', get_post_type_object( $post->post_type )->labels->singular_name, get_the_author_meta( 'display_name', $post->post_author ) );

    wp_add_inline_script(
        'wp-notices',
        sprintf( 'wp.domReady(function(){wp.data.dispatch("core/notices").createInfoNotice(%s,{id:"wpide-other-author"});});', wp_json_encode( $message ) ),
        'after'
    );
    wp_enqueue_script( 'wp-notices' );
    wp_enqueue_script( 'wp-dom-ready' );
} );
```

## Notes

Shows the original author's name; it does not lock the post.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Notice When Editing Someone Else's Post" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
