# Elementor Posts Query: More Posts by the Same Author

> Adds a custom query ID "wpide_same_author" that lists other posts by the author of the post being viewed, for "More from this writer" sections.

- Type: PHP
- Runs: Run everywhere
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, query, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-query-same-author/

## Code

```php
add_action( 'elementor/query/wpide_same_author', function ( $query ) {
    if ( ! is_singular() ) {
        return;
    }

    $post = get_queried_object();

    if ( ! $post instanceof WP_Post ) {
        return;
    }

    $query->set( 'author', (int) $post->post_author );
    $query->set( 'post__not_in', array( $post->ID ) );
    $query->set( 'ignore_sticky_posts', true );
} );
```

## Notes

Type wpide_same_author in the Query ID field of a widget in your single post template.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Elementor Posts Query: More Posts by the Same 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/
