Make WordPress Core

Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#54364 closed defect (bug) (wontfix)

permalink from REST API is wrong when wp_unique_post_slug is filtered

Reported by: nilav18's profile nilav18 Owned by:
Milestone: Priority: normal
Severity: minor Version: 5.8.1
Component: Permalinks Keywords:
Focuses: administration, rest-api Cc:



I use a filter on wp_unique_post_slug
add_filter( 'wp_unique_post_slug', 'custom_unique_post_slug', 1, 5 );
I think there is no need for the moment to show you what I do because with PHP, it works like a charm. But, with REST API, the permalink is not updated.

For example, the snackbar "Page updated. View page" get the post_name before my filter. But if I refresh the page, everything is ok. Not a big problem, just if I click on the link "View page", I have a wrong url and I get a 404 error.

Change History (4)

#1 @nilav18
19 months ago

#54365 was marked as a duplicate.

#2 @nilav18
19 months ago

I forgot to say that I use Gutenberg.

#3 @nilav18
19 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

Sorry, I finally found my error. I have to apply my function (custom_unique_post_slug) also in my callback function for the filter post_type_link.

#4 @desrosj
19 months ago

  • Component changed from General to Permalinks
  • Focuses rest-api added
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.