#54571 closed defect (bug) (invalid)
Creating post via REST API with custom slug and "publish" status appends "-2" to slug
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | rest-api | Cc: |
Description
I'm trying to create a new post via the REST API (using a Python script). There are no existing posts, not even in the trash. If I create the post using this data:
post = { "title": "test title", "content": "test content", "slug": "001", "status": "publish", "tags": [3], }
It gets assigned the slug "001-2" which cannot even be edited afterwards. It's like there's some ghost post claiming the desired slug.
If I change the post data to not publish the post:
post = { "title": "test title", "content": "test content", "slug": "001", "tags": [3], }
It gets the correct "001" slug.
Change History (5)
#2
follow-up:
↓ 4
@
18 months ago
I suspect this might have something to do with the specific installation then, which has various plugins installed and uses Oxygen to build pages.
#4
in reply to:
↑ 2
@
18 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version 5.8.2 deleted
Replying to markus.magnuson:
I suspect this might have something to do with the specific installation then, which has various plugins installed and uses Oxygen to build pages.
Thanks for checking back! With this comment in mind, I'm going to close the ticket as being likely caused by a plugin, but please don't hesitate to reopen the ticket with more details if it turns out the issue can be traced back to core.
Hi @markusmagnuson, and thanks for the ticket!
I've been unable to replicate this behavior so far on a new installation. The slug of the published post is
001
as expected. Are you able to test on a site with plugins deactivated and a default theme?