Skip to content

Commit 52a17a9

Browse files
committed
Merge branch 'develop' into trunk
2 parents 28495ba + 01987fb commit 52a17a9

16 files changed

Lines changed: 254 additions & 80 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ All notable changes to this project will be documented in this file, per [the Ke
1414
### Developer
1515
-->
1616

17+
## [5.3.2] - 2025-11-21
18+
19+
### Added
20+
* Notice about keeping the sync page open during the sync process. Props [@felipeelia](https://github.com/felipeelia) and [@tott](https://github.com/tott) via [#4240](https://github.com/10up/ElasticPress/pull/4240).
21+
22+
### Fixed
23+
* Media search not working in the admin dashboard. Props [@burhandodhy](https://github.com/burhandodhy), [@ognjanovic](https://github.com/ognjanovic), and [@maciejmackowiak](https://github.com/maciejmackowiak) via [#4239](https://github.com/10up/ElasticPress/pull/4239).
24+
* [Autosuggest] Setting allowed values. Props [@felipeelia](https://github.com/felipeelia) via [#4238](https://github.com/10up/ElasticPress/pull/4238).
25+
1726
## [5.3.1] - 2025-11-06
1827

1928
### Fixed
@@ -2300,6 +2309,8 @@ This is a bug fix release with some filter additions.
23002309
- Initial plugin release
23012310

23022311
[Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop
2312+
[5.3.2]: https://github.com/10up/ElasticPress/compare/5.3.1...5.3.2
2313+
[5.3.1]: https://github.com/10up/ElasticPress/compare/5.3.0...5.3.1
23032314
[5.3.0]: https://github.com/10up/ElasticPress/compare/5.2.0...5.3.0
23042315
[5.2.0]: https://github.com/10up/ElasticPress/compare/5.1.4...5.2.0
23052316
[5.1.4]: https://github.com/10up/ElasticPress/compare/5.1.3...5.1.4

CREDITS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ Thank you to all the people who have already contributed to this repository via
260260
[Scott Buckel (@scottbuckel)](https://github.com/scottbuckel),
261261
[@jzzaj](https://github.com/jzzaj),
262262
[@DarioBF](https://github.com/DarioBF),
263+
[@ognjanovic](https://github.com/ognjanovic),
264+
[Maciej Maćkowiak (@maciejmackowiak)](https://github.com/maciejmackowiak),
263265
and
264266
[@qazaqstan2025](https://github.com/qazaqstan2025).
265267

assets/js/sync-ui/apps/sync.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ export default () => {
131131
: __('in Elasticsearch', 'elasticpress'),
132132
)}
133133
</p>
134+
<p>
135+
<b>
136+
{__(
137+
'The sync will pause if you close this window. Please keep it open until completion.',
138+
'elasticpress',
139+
)}
140+
</b>
141+
</p>
134142
<Panel className="ep-sync-panel">
135143
<PanelBody className="ep-sync-panel__controls">
136144
{isSyncing || isComplete ? <Progress /> : null}

elasticpress.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: ElasticPress
44
* Plugin URI: https://github.com/10up/ElasticPress
55
* Description: A fast and flexible search and query engine for WordPress.
6-
* Version: 5.3.1
6+
* Version: 5.3.2
77
* Requires at least: 6.2
88
* Requires PHP: 7.4
99
* Author: 10up
@@ -33,7 +33,7 @@
3333
define( 'EP_URL', plugin_dir_url( __FILE__ ) );
3434
define( 'EP_PATH', plugin_dir_path( __FILE__ ) );
3535
define( 'EP_FILE', plugin_basename( __FILE__ ) );
36-
define( 'EP_VERSION', '5.3.1' );
36+
define( 'EP_VERSION', '5.3.2' );
3737

3838
define( 'EP_PHP_VERSION_MIN', '7.4' );
3939

includes/classes/Command.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,18 @@ public function epio_set_autosuggest( $args, $assoc_args ) {
621621
WP_CLI::success( esc_html__( 'Done.', 'elasticpress' ) );
622622
}
623623

624+
/**
625+
* A WP-CLI wrapper to run `Autosuggest::post_deactivation()`.
626+
*
627+
* @subcommand epio-reset-autosuggest
628+
* @since 5.3.2
629+
*/
630+
public function epio_reset_autosuggest() {
631+
Features::factory()->get_registered_feature( 'autosuggest' )->post_deactivation();
632+
633+
WP_CLI::success( esc_html__( 'Done.', 'elasticpress' ) );
634+
}
635+
624636
/**
625637
* Helper method for creating the network alias for an indexable
626638
*

includes/classes/Feature.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,23 @@ public function post_activation() {
291291
do_action( 'ep_feature_post_activation', $this->slug, $this );
292292
}
293293

294+
/**
295+
* To be run after feature deactivation
296+
*
297+
* @since 5.3.2
298+
*/
299+
public function post_deactivation() {
300+
/**
301+
* Fires after feature is deactivated
302+
*
303+
* @hook ep_feature_post_deactivation
304+
* @param {string} $slug Feature slug
305+
* @param {Feature} $feature Current feature
306+
* @since 5.3.2
307+
*/
308+
do_action( 'ep_feature_post_deactivation', $this->slug, $this );
309+
}
310+
294311
/**
295312
* Returns the feature title.
296313
*

includes/classes/Feature/Autosuggest/Autosuggest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ public function epio_send_autosuggest_allowed() {
686686

687687
add_filter( 'ep_format_request_headers', [ $this, 'add_ep_set_autosuggest_header' ] );
688688

689+
$search_query['query_vars']['ep_intercept_request'] = false;
689690
Elasticsearch::factory()->query( $index, 'post', $es_search_query, $search_query['query_vars'] );
690691

691692
remove_filter( 'ep_format_request_headers', [ $this, 'add_ep_set_autosuggest_header' ] );
@@ -790,6 +791,24 @@ public function epio_autosuggest_set_and_get() {
790791
return $allowed_params;
791792
}
792793

794+
/**
795+
* Send a request to EP.io to reset the allowed parameters for autosuggest.
796+
*
797+
* @since 5.3.2
798+
*/
799+
public function post_deactivation() {
800+
$index = Indexables::factory()->get( 'post' )->get_index_name();
801+
802+
add_filter( 'ep_format_request_headers', [ $this, 'add_ep_set_autosuggest_header' ] );
803+
804+
Elasticsearch::factory()->query( $index, 'post', [], [] );
805+
806+
remove_filter( 'ep_format_request_headers', [ $this, 'add_ep_set_autosuggest_header' ] );
807+
808+
// this action is documented in Feature.php
809+
do_action( 'ep_feature_post_deactivation', $this->slug, $this );
810+
}
811+
793812
/**
794813
* Return true, so EP knows we want to intercept the remote request
795814
*

includes/classes/Feature/ProtectedContent/ProtectedContent.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,9 @@ public function maybe_change_sort( $default_sort ) {
464464
* @return array
465465
*/
466466
public function filter_private_posts_for_current_user( $formatted_args, $args ): array {
467-
$post_types = (array) $args['post_type'];
468-
467+
$post_statuses = ! empty( $args['post_status'] ) ? $args['post_status'] : [];
468+
$post_statuses = is_string( $post_statuses ) ? explode( ',', $post_statuses ) : $post_statuses;
469+
$post_types = ! empty( $args['post_type'] ) ? (array) $args['post_type'] : [];
469470
$valid_post_types = array_filter( $post_types, 'post_type_exists' );
470471

471472
$base_statuses = array_merge(
@@ -476,8 +477,9 @@ public function filter_private_posts_for_current_user( $formatted_args, $args ):
476477
'show_in_admin_all_list' => true,
477478
]
478479
),
479-
! empty( $args['post_status'] ) ? (array) $args['post_status'] : []
480+
$post_statuses
480481
);
482+
$base_statuses = array_unique( $base_statuses );
481483

482484
$post_types_with_capability = [];
483485
$post_types_without_capability = [];
@@ -502,6 +504,7 @@ public function filter_private_posts_for_current_user( $formatted_args, $args ):
502504

503505
if ( ! empty( $post_types_with_capability ) ) {
504506
$all_statuses = array_merge( $base_statuses, get_post_stati( [ 'private' => true ] ) );
507+
$all_statuses = array_unique( $all_statuses );
505508

506509
$should_clauses[] = [
507510
'bool' => [

includes/classes/Features.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ public function update_feature( $slug, $settings, $force = true, $target = 'curr
214214

215215
$feature->post_activation();
216216
}
217+
if ( $was_active && ! $is_active && method_exists( $feature, 'post_deactivation' ) ) {
218+
$feature->post_deactivation();
219+
}
217220

218221
/**
219222
* If the feature has a setting that requires reindexing, return

includes/classes/StatusReport/ElasticPressIo.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,24 @@ protected function get_autosuggest_group(): array {
6060
$title = __( 'Allowed Autosuggest Parameters', 'elasticpress' );
6161
$allowed_params = $autosuggest_feature->epio_autosuggest_set_and_get();
6262

63+
$reset_url = [
64+
'label' => 'Reset URL',
65+
'value' => wp_kses_post(
66+
sprintf(
67+
/* translators: %s: URL */
68+
__( 'If you need to reset the allowed parameters, you can do so by saving your Search Fields & Weighting settings or by visiting <a href="%s">this URL</a>.', 'elasticpress' ),
69+
$autosuggest_feature->get_epio_public_request_url()
70+
)
71+
),
72+
];
73+
6374
if ( empty( $allowed_params ) ) {
64-
$fields['not_available'] = [
65-
'label' => __( 'Allowed Autosuggest Parameters', 'elasticpress' ),
66-
'value' => __( 'Allowed autosuggest parameters info not available.', 'elasticpress' ),
75+
$fields = [
76+
'not_available' => [
77+
'label' => __( 'Allowed Autosuggest Parameters', 'elasticpress' ),
78+
'value' => __( 'Allowed autosuggest parameters info not available.', 'elasticpress' ),
79+
],
80+
'url' => $reset_url,
6781
];
6882

6983
return [
@@ -98,16 +112,7 @@ protected function get_autosuggest_group(): array {
98112
];
99113
}
100114

101-
$formatted_fields['url'] = [
102-
'label' => 'Reset URL',
103-
'value' => wp_kses_post(
104-
sprintf(
105-
/* translators: %s: URL */
106-
__( 'If you need to reset the allowed parameters, you can do so by saving your Search Fields & Weighting settings or by visiting <a href="%s">this URL</a>.', 'elasticpress' ),
107-
$autosuggest_feature->get_epio_public_request_url()
108-
)
109-
),
110-
];
115+
$formatted_fields['url'] = $reset_url;
111116

112117
return [
113118
'title' => $title,

0 commit comments

Comments
 (0)