Opened 19 months ago
Closed 7 months ago
#62135 closed defect (bug) (worksforme)
Custom Post Type feed rewrites not generated when has_archive is false
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | |
| Component: | Posts, Post Types | Keywords: | reporter-feedback close |
| Focuses: | Cc: |
Description
I have a Custom Post Type called movies. In the registration, I've set has_archive to false but rewrite.feeds to true.
The [documentation of parameters](https://developer.wordpress.org/reference/functions/register_post_type/#parameters) leads me to believe that this would cause feed rewrites being generated in /movies/feed although I don't have archive at /movies.
feeds bool
Whether the feed permastruct should be built for this post type.
Default is value of $has_archive.
That is not what happens. The feed permastruct is not built unless has_archive is true. See https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-post-type.php#L712-L725
Change History (2)
#2
@
7 months ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
Given that one month has passed and no answer by the reporter, I think it's a good time to close this as worksforme.
@sippis feel free to comment back if you have any information to add for reproduction and testing, and I will be happy to get back to this ticket and help move it forward.
Reproduction Report
Description
❌ This report can't validates that the issue can be reproduced.
Environment
Testing Instructions
Actual Results
Additional Notes
has_archivetofalsewhile usingrewrite.feedstotrueand the feed can be accessed without troubles.closeas it cannot be reproduced for now while the reporter could inform in case he can provide more information for reproduction purposes.Supplemental Artifacts
Sample code:
add_action( 'init', function() { register_post_type( 'movies', [ 'label' => 'Movies', 'public' => true, 'has_archive' => false, 'rewrite' => array( 'feeds' => true, ), 'supports' => [ 'title', 'editor', ], ] ); } );