# Send WPForms Notifications to the Page Author

> Sends WPForms notifications to the author of the post or page where the form was filled in, for agent, listing or team profile pages.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: wpforms, notifications, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpforms-notify-page-author/

## Code

```php
$wpide_wpf_author_forms = array(); // Form IDs, e.g. array( 1 ).

add_filter( 'wpforms_entry_email_atts', function ( $email, $fields, $entry, $form_data ) use ( $wpide_wpf_author_forms ) {
    if ( ! in_array( (int) $form_data['id'], array_map( 'intval', $wpide_wpf_author_forms ), true ) ) {
        return $email;
    }

    $page_id = isset( $_POST['page_id'] ) ? absint( $_POST['page_id'] ) : url_to_postid( (string) wp_get_referer() );
    $post    = $page_id ? get_post( $page_id ) : null;
    $author  = $post ? get_userdata( (int) $post->post_author ) : false;

    if ( $author && is_email( $author->user_email ) ) {
        $email['address'] = array( $author->user_email );
    }

    return $email;
}, 10, 4 );
```

## Notes

Limit it to forms in the list at the top; the original recipients are used when the page cannot be found.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Send WPForms Notifications to the Page Author" 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/
