WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 7 months ago

Last modified 7 months ago

#26269 closed enhancement (invalid)

register_taxonomy should accept has_archive

Reported by: mattbeck Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

Taxonomies can and should be used by custom themes/plugins to connect posts/pages together.

It's not always desirable to expose this relationship publicly with an archive view, and if overlooked can cause undesired results or content duplication issues in search engine indexes.

Following the same process as registering a custom post type, the register_taxonomy function should accept the has_archive bool.

Change History (6)

comment:1 @nofearinc17 months ago

What would be the difference with the has_archive argument for register_post_type calls?

comment:2 @mattbeck17 months ago

Taxonomies are not always tied to a specific post type, and they have their own archive pages.

Those archive pages should be disable-able.

Currently if you don't want to expose the taxonomy's archive page, you have to set up a 301 or some such.

comment:3 @wonderboymusic11 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

comment:4 @husobj7 months ago

Related to #13816 ?

comment:5 follow-up: @nacin7 months ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

The very concept of has_archive (as it applies to post types) doesn't exist for taxonomies. See #13816. If you want to suppress /tag/foo/ pages, you'll want to evaluate the rewrite and public args.

comment:6 in reply to: ↑ 5 @mattbeck7 months ago

Replying to nacin:

The very concept of has_archive (as it applies to post types) doesn't exist for taxonomies. See #13816. If you want to suppress /tag/foo/ pages, you'll want to evaluate the rewrite and public args.

Gotcha, that wasn't clear.

Updated the codex to reflect this method.
http://codex.wordpress.org/Function_Reference/register_taxonomy#Example_Private_Taxonomy

Note: See TracTickets for help on using tickets.