Consider the simplest archive.php possible:



while ( have_posts() ) {


What address should I type into the browser to get to this page and display all posts? The permalink Custom Struction is set as "/%category%/%postname%/". I have tried going http://example.com/posts but that page returns simply a 404 error.

  • Are you maybe looking for: example.com?post_type=post&cat=category-slug ? – admcfajn Dec 8 '18 at 4:06
  • @admcfajn: No. I would like the page to display all posts, regardless of post type or category. – dotancohen Dec 10 '18 at 11:02

archive.php is very broad template, possibly used for many kinds of archives.

If you mean common reverse chronological view the link to that would be return of get_post_type_archive_link() for the specific post type.

Note that the native post post type is special case. For it archive is typically either site root or posts page, depending on site's configuration. Those never use archive.php, according to template hierarchy.

  • 1
    It is exactly because archive.php is a broad template that I would prefer to use it. The archive.php file is called for many different URLs, such as http://example.com/foo_type/, http://example.com/foo_category/, http://example.com/foo_tag/, http://example.com/foo_date/, etc. But which URL should be used to get an archive of all the posts? – dotancohen May 30 '16 at 6:03
  • Had you read my answer? If you mean post type posts — they will never use archive.php template for main archive. – Rarst May 30 '16 at 6:22
  • I'm sorry for not clarifying my position, I did not want to seem contradictory. In fact, post type posts do use archive.php when the URLs mentioned in the above comment are called. However, each of those URLs applies a filter to The Loop behind the scenes, limiting the returned posts to only a specific category, tag, date, etc. I need to know the URL address to use which will not apply any filter. I agree that this case is not addressed in the Template Hierarchy wiki page. – dotancohen May 30 '16 at 6:52
  • Again, this is covered in the answer — archive for all of posts will be site root or posts page (depending on Settings > Reading > Front Page Displays). It won't use archive.php because it's in a different branch of template hierarchy. – Rarst May 30 '16 at 6:57
  • Yes, thank you. Perhaps home.php would be a good alternative, seeing how it is labeled "Blog posts index page". What URL would one type into the browser to get to home.php? – dotancohen May 30 '16 at 7:59

The URL for archive.php to list all posts which do not have a category assigned is:


This can be found be going to any post which has not been assigned a category, and examining the URL. Just remove the post slug to arrive at the relevant archive:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.