Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To display more posts by the same author below a WordPress article, run a second get_posts() or WP_Query query using the current author’s numeric ID, exclude the current post, and render the results. You can add the code to a child theme or use a code-snippet plugin; choose a related-posts plugin instead if editors need settings for placement, layout, and filtering.

How the same-author query works

WordPress’s query parameters let you filter posts by author, exclude the post currently being viewed, and limit or order the results. Use the author’s numeric user ID where possible: author takes that ID, while author_name expects the user’s nicename rather than their display name. See the WordPress query parameter documentation for supported author, post type, taxonomy, exclusion, and ordering arguments.

For a straightforward list beneath a single post, the query needs three essentials: the current author ID, the current post ID in post__not_in, and an intentional posts_per_page limit. The example below uses get_posts() and adds five same-author posts to the end of the content.

Add a same-author list below each post

Place this PHP in a child theme’s functions.php file or in a code-snippet manager such as WPCode. Avoid adding custom code directly to a parent theme, since a theme update can replace its files. This pattern follows the example in WPBeginner’s February 13, 2025 tutorial.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
function freedom251_related_author_posts( $content ) {
    if ( ! is_single() || ! in_the_loop() || ! is_main_query() ) {
        return $content;
    }

    $author_id = (int) get_post_field( 'post_author', get_the_ID() );
    $current_id = (int) get_the_ID();

    $related_posts = get_posts( array(
        'author'         => $author_id,
        'post__not_in'   => array( $current_id ),
        'posts_per_page' => 5,
        'post_type'      => 'post',
        'orderby'        => 'date',
        'order'          => 'DESC',
    ) );

    if ( ! $related_posts ) {
        return $content;
    }

    $author_name = get_the_author_meta( 'display_name', $author_id );
    $html = '<section class="related-author-posts" aria-label="More posts by ' . esc_attr( $author_name ) . '">';
    $html .= '<h2>More posts by ' . esc_html( $author_name ) . '</h2><ul>';

    foreach ( $related_posts as $related_post ) {
        $html .= '<li><a href="' . esc_url( get_permalink( $related_post ) ) . '">';
        $html .= esc_html( get_the_title( $related_post ) ) . '</a></li>';
    }

    $html .= '</ul></section>';
    return $content . $html;
}
add_filter( 'the_content', 'freedom251_related_author_posts' );

The code runs only for the main content loop on a single post, retrieves up to five published posts of the standard post type by that author, and orders them newest first. It returns the original article unchanged if no matching posts are found. The title, author name, and link are escaped for HTML output.

Choose the number and order deliberately

Change posts_per_page to the number that fits your design. The example uses orderby => 'date' and order => 'DESC', so the most recently published matching posts appear first. Other ordering choices may suit an editorial workflow, but set both values intentionally rather than relying on an unstated default.

Keep the exclusion argument as an integer array

post__not_in must receive an array of post IDs, as shown. Do not pass a comma-separated string. WordPress also warns that post__in and post__not_in cannot be combined in the same query; consult the core query documentation if you extend the selection logic.

Decide what “related” should mean

Same author is one relationship, but it does not necessarily mean the posts cover the same subject. Add constraints if readers should see only posts that match the current article’s category or tags. WordPress supports category and tag query parameters, including category__in and tag__in; combine the taxonomy condition with the author condition to narrow results.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Same author only: use the author condition shown in the example.
  • Same author and category or tag: add the relevant taxonomy filter so the list is topically closer.
  • Standard posts only: retain 'post_type' => 'post'.
  • Custom post types: change post_type to include the specific registered types you want. WordPress query arguments can accept one type or multiple types.

Choose code or a plugin

Use custom code when the site needs a small, predictable list and you want direct control over its query and markup. A plugin is a better fit when editors need to adjust behavior without changing PHP. Compare options by placement, filtering, layout, editor controls, caching, accessibility of the generated markup, and compatibility with the site’s installed WordPress version.

Approach Best suited to Documented capabilities
Custom query A fixed, theme-controlled list with specific query or markup requirements. Author filtering, exclusion, count, post type, and ordering are controlled in the code.
Related Posts By PickPlugins Sites that want configurable display and selection options. The plugin listing describes author-archive placement, custom post types, manual selection, maximum counts, ordering, category, tag and custom-taxonomy queries, grid, slider and list layouts, click tracking, and shortcode output. See the WordPress.org plugin listing.
Custom Related Posts Sites that need configurable relation fields or search behavior. The listing documents author, date and excerpt fields, configurable search, relation caching, self-reference controls, and a WordPress 6.8 compatibility improvement in its changelog. See the WordPress.org plugin listing.

WPBeginner recommends WPCode as a way to add the PHP snippet without editing a theme file. Whether using a snippet manager or a plugin, check its current documentation, compatibility, and generated output against your own site before enabling it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the result on your site

  1. Open a single post by an author who has other published posts.
  2. Confirm the section appears after the article, the current post is absent, and the displayed count does not exceed the configured limit.
  3. Open a link and confirm it reaches the intended post. Check that the visible author name and post titles display correctly.
  4. Test an author with no other matching posts, a post with a different author, and any custom post type or taxonomy combinations you added.
  5. Review the section’s keyboard navigation and screen-reader label, and verify its appearance on mobile and desktop themes.

If nothing appears, first check that the author has other published posts matching the selected post type and taxonomy filters. If the section appears more than once, confirm the filter is running only for the main single-post content; the example uses in_the_loop() and is_main_query() for that reason.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.