Skip to content

Commit

Permalink
Search: Fix fatal error in dev mode, and add a message (#10812)
Browse files Browse the repository at this point in the history
Fixes #10632 

Also adds a simple message in dev mode to indicate that Jetpack Search is not supported.

See issue for instructions.


**Proposed changelog entry**

- Fixes fatal error when Jetpack Search Widget is enabled while site is in Development Mode.
  • Loading branch information
gibrown authored and jeherve committed Dec 5, 2018
1 parent e61bf64 commit e6fe5a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/widgets/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,19 @@ public function widget( $args, $instance ) {

$display_filters = false;

if ( Jetpack::is_development_mode() ) {
echo $args['before_widget'];
?><div id="<?php echo esc_attr( $this->id ); ?>-wrapper">
<div class="jetpack-search-sort-wrapper">
<label>
<?php esc_html_e( 'Jetpack Search not supported in Development Mode', 'jetpack' ); ?>
</label>
</div>
</div><?php
echo $args['after_widget'];
return;
}

if ( is_search() ) {
if ( Jetpack_Search_Helpers::should_rerun_search_in_customizer_preview() ) {
Jetpack_Search::instance()->update_search_results_aggregations();
Expand Down

0 comments on commit e6fe5a1

Please sign in to comment.