WordPress.org

Make WordPress Core

Opened 7 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#54571 closed defect (bug) (invalid)

Creating post via REST API with custom slug and "publish" status appends "-2" to slug

Reported by: markus.magnuson 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)

#1 @dlh
7 weeks ago

  • Keywords reporter-feedback added

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?

#2 follow-up: @markus.magnuson
4 weeks 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.

#3 @markus.magnuson
4 weeks ago

  • Keywords reporter-feedback removed

#4 in reply to: ↑ 2 @dlh
4 weeks 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.

#5 @SergeyBiryukov
4 weeks ago

  • Component changed from General to Posts, Post Types
Note: See TracTickets for help on using tickets.