Instant Search: Use href to restore previous location state #13825
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #13808.
Changes proposed in this Pull Request:
site_url()
from PHP.window.location.href
on page load for future use.href
on page load is restored onto window.location via the History API.Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
Add
define( "JETPACK_SEARCH_PROTOTYPE", true );
to your wp-config.php.If using Jetpack's Docker development environment, you can create a file at
/docker/mu-plugins/instant-search.php
and add the define there.Ensure that your site has the Jetpack Pro plan and Jetpack Search enabled.
You can enable Jetpack Search in the Performance tab within the Jetpack menu (
/wp-admin/admin.php?page=jetpack#/performance
).Select a theme of your choosing and add a Jetpack Search widget to the site via the customizer, preferably with some filters enabled. If you're using a theme with a sidebar widget area, please add the Jetpack Search widget there.
Navigate to a URL with a query parameter in the URL, like
?testQuery=true
.Perform a search by entering some text into the search input box. Ensure that a query string value for your search term has been appended onto the URL (e.g.
/?testQuery=true&
s=some-search-value
).Hide the search interface by deleting the text in the search input box. Ensure that the URL has been restored to
/?testQuery=true
Proposed changelog entry for your changes: