Skip to content

Fix: Template Part 403 request error occurs in edit mode#68674

Closed
dhananjaykuber wants to merge 1 commit intoWordPress:trunkfrom
dhananjaykuber:fix/template-part-403-error-in-editor
Closed

Fix: Template Part 403 request error occurs in edit mode#68674
dhananjaykuber wants to merge 1 commit intoWordPress:trunkfrom
dhananjaykuber:fix/template-part-403-error-in-editor

Conversation

@dhananjaykuber
Copy link
Copy Markdown
Contributor

@dhananjaykuber dhananjaykuber commented Jan 15, 2025

Fixes #68670

What?

Prevents unnecessary API requests for post preview links when editing template parts in the site editor, which currently causes 403 errors to appear in the browser console.

How?

Modified the PostPreviewButton component to only fetch preview links when the post type is actually viewable. This is done by:

  1. Checking the viewable status early in the useSelect hook
  2. Only calling getEditedPostPreviewLink() if the content is viewable

@Mamaduka
Copy link
Copy Markdown
Member

Superseded by #68678.

@Mamaduka Mamaduka closed this Jan 15, 2025
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.

Template Part: 403 request error occurs in edit mode

2 participants