# Serve a humans.txt File

> Answers /humans.txt with a plain-text file crediting the people and tools behind the site, generated by WordPress so you do not need to upload anything to the server.

- Type: PHP
- Runs: Run everywhere
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: rewrite-rules, humans-txt, credits
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/rewrite-humans-txt/

## Code

```php
// File contents.
$wpide_humans_txt = "/* TEAM */\nDeveloper: Jane Doe\nContact: hello@example.com\nLocation: Lisbon, Portugal\n\n/* SITE */\nStandards: HTML5, CSS3\nSoftware: WordPress";

add_action( 'init', function () {
    add_rewrite_rule( '^humans\.txt$', 'index.php?wpide_humans=1', 'top' );
} );

add_filter( 'query_vars', function ( $vars ) {
    $vars[] = 'wpide_humans';
    return $vars;
} );

add_action( 'template_redirect', function () use ( $wpide_humans_txt ) {
    if ( ! get_query_var( 'wpide_humans' ) ) {
        return;
    }

    header( 'Content-Type: text/plain; charset=utf-8' );
    header( 'X-Robots-Tag: noindex' );
    echo wp_strip_all_tags( $wpide_humans_txt ) . "\n\n/* UPDATED */\nLast update: " . esc_html( mysql2date( 'Y/m/d', get_lastpostmodified( 'blog' ) ) ) . "\n";
    exit;
} );
```

## Notes

Edit $wpide_humans_txt; save Settings > Permalinks once so WordPress learns the new address. A real humans.txt file on the server takes priority.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Serve a humans.txt File" 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/
