Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: Preserve query params on initial redirect #2727

Closed

Conversation

Mamaduka
Copy link
Member

PR fixes the issue when query parameters are removed on Site Editor homepage redirection.

Trac ticket: https://core.trac.wordpress.org/ticket/55752


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@@ -30,7 +30,7 @@
$home_template = _resolve_home_block_template();
if ( $home_template && empty( $_GET['postType'] ) && empty( $_GET['postId'] ) ) {
$redirect_url = add_query_arg(
$home_template,
array_merge( $home_template, $_GET ),
Copy link
Member Author

Choose a reason for hiding this comment

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

I went with a general fix. But I can update this only to support the styles query param.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's simply support styles for now and if a general fix is needed it can be done later.

With a general fix visiting http://wp-dev.local/wp/wp-admin/site-editor.php?styles=open&postType= (I'm the worst, I know 😉) ended up with a white screen rather than the site editor.

I'll push to this branch

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @peterwilsoncc.

We can land general fix in the next major release.

@gziolo gziolo requested a review from peterwilsoncc May 18, 2022 08:47
Copy link

@creativecoder creativecoder left a comment

Choose a reason for hiding this comment

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

Confirming that this fixes https://core.trac.wordpress.org/ticket/55752. Thanks!

I think the general fix is nice in case more params are added in the future, or plugins use params in some way to affect the editor.

@peterwilsoncc
Copy link
Contributor

@Mamaduka Mamaduka deleted the fix/site-editor-query-params branch September 13, 2022 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants