[WordPress] How to not create an archive for the author/poster

[WordPress] How to not create author/poster archives

This is a memorandum.

When checking which pages were viewed using Google Analytics, I noticed an unfamiliar URL.

unfamiliar URL

It seems that the poster page/archive is automatically generated by default.

I am the only contributor to this site.
I think this is the case with most personal blogs, but there's not much point in creating a poster archive.

So, I'll do something about it.

How not to create author/contributor archives

Add the following sentence to functions.php.

add_filter('author_rewrite_rules','__return_empty_array');

We use author_rewrite_rules to filter the rewrite rules that generate author archive page URLs.

Then we run flush_rules(), which is the function that regenerates the rewrite rules and saves them to the database.

flush_rules() is called to update permalinks, so go to "Settings" → "Permalink Settings" on the dashboard and update without making any changes

The above method was based on the following website.
via:
How to not create an author (poster) archive in WordPress (studying rewrite rules) | Gatespace's Blog via:
How to create a WordPress theme » How to delete an author page via: Function Reference/WP Rewrite - WordPress Codex Japanese version

  • Add this entry to Hatena Bookmarks

At "naouniverse.com", the administrator writes about things, things, and the world that interest him.
Gadgets, cameras, design, programming, L'Arc~en~Ciel, etc...