WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#31804 closed enhancement (maybelater)

Explicitly declare whether or not a post type supports attachments

Reported by: danielbachhuber Owned by: danielbachhuber
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

In WP-API, we'd like to add a link to all attachments associated with a given Post, Page, or other post type. However, there's no way currently to determine whether a post type supports attachments. We should make this more explicit.

From https://github.com/WP-API/WP-API/pull/1026/files#r27358934

Change History (6)

#1 @helen
7 years ago

What else would that kind of specification entail? Turning off parts of core UI? Explicit checks before assigning the post_parent? Why enforce this just for attachments, and/or does doing it just for attachments possibly affect other kinds of many-to-one relationships the post_parent field enables?

#2 @danielbachhuber
7 years ago

What else would that kind of specification entail? Turning off parts of core UI? Explicit checks before assigning the post_parent?

This is certainly something that needs to be fleshed out. At the very least, it could be an informational flag for WP-API — post_type_supports( 'attachment' ). However, it's worthwhile to do some technical discovery on whether such a flag should have an impact on existing components and UI in WordPress.

I'm open to suggestions on how we could make the inference that a post type supports attachments if we want to punt on adding something to core, but I don't have any great ideas at the moment.

#3 @rmccue
7 years ago

  • Keywords rest-api added; wp-api removed

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.


6 years ago

#5 @danielbachhuber
6 years ago

  • Milestone changed from Future Release to 4.5
  • Owner set to danielbachhuber
  • Status changed from new to assigned

#6 @danielbachhuber
6 years ago

  • Keywords needs-patch dev-feedback rest-api removed
  • Milestone 4.5 deleted
  • Resolution set to maybelater
  • Status changed from assigned to closed

While the purist in me really wants an API for this relationship, pragmatically it doesn't have much value for the REST API. It's fine that all post types (except revisions and attachments) support uploading attachments.

Note: See TracTickets for help on using tickets.