Skip to content

Conversation

@Muhammad-Hassaan-Farooq

What?

The unpublish button on the admin panel sends a request to the wrong url if the application has a base path configured in the next config. This PR uses the formatAdminURL function to conditionally add the base path if needed.

Why?

Unpublish button does not work if base path is set.

How?

Using the formatAdminURL correctly includes the basePath in the url

Fixes #15369

@Muhammad-Hassaan-Farooq Muhammad-Hassaan-Farooq changed the title fix(ui): Use the formatAdminUrl function to generate unpublish url fix(ui): use the formatAdminUrl function to generate unpublish url Jan 27, 2026
url = `${serverURL}${api}/${collectionSlug}/${id}${queryString}`
url = formatAdminURL({
apiRoute: api,
path: `/${collectionSlug}${id ? `/${id}` : ''}${queryString}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check for id? unpublish would mean you have a doc already, yeah?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah true. Let me remove the check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 👍

@JarrodMFlesch JarrodMFlesch merged commit 453e8a6 into payloadcms:main Jan 27, 2026
195 of 198 checks passed
@github-actions
Copy link
Contributor

🚀 This is included in version v3.74.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unpublish button does not include base path

2 participants