PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | includes/classes/Feature/Search/Search.php +200 -157 4.6.05.3.5 View file →
@@ -51,14 +51,10 @@
51 51 */
52 52 public function __construct() {
53 53 $this->slug = 'search';
54 54
55 - $this->title = esc_html__( 'Post Search', 'elasticpress' );
55 + $this->group = 'core-search';
56 56
57 - $this->summary = __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' );
58 -
59 - $this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#post-search', 'elasticpress' );
60 -
61 57 $this->requires_install_reindex = false;
62 58
63 59 $this->default_settings = [
64 60 'decaying_enabled' => '1',
@@ -73,8 +69,29 @@
73 69 parent::__construct();
74 70 }
75 71
76 72 /**
73 + * Sets i18n strings.
74 + *
75 + * @return void
76 + * @since 5.2.0
77 + */
78 + public function set_i18n_strings(): void {
79 + $this->title = esc_html__( 'Post Search', 'elasticpress' );
80 +
81 + $this->summary = '<p>' . __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' ) . '</p>' .
82 + '<p>' . __( 'Overcome higher-end performance and functional limits posed by the traditional WordPress structured (SQL) database to deliver superior keyword search, instantly. ElasticPress indexes custom fields, tags, and other metadata to improve search results. Fuzzy matching accounts for misspellings and verb tenses.', 'elasticpress' ) . '</p>';
83 +
84 + $this->docs_url = __( 'https://www.elasticpress.io/resources/articles/configuring-elasticpress-via-the-plugin-dashboard/#post-search', 'elasticpress' );
85 +
86 + $this->field_group_map = [
87 + 'highlight_group' => [
88 + 'label' => esc_html__( 'Highlighting Options', 'elasticpress' ),
89 + ],
90 + ];
91 + }
92 +
93 + /**
77 94 * We need to delay search setup up since it will fire after protected content and protected
78 95 * content filters into the search setup
79 96 *
80 97 * @since 2.2
@@ -79,10 +96,11 @@
79 96 *
80 97 * @since 2.2
81 98 */
82 99 public function setup() {
100 + Indexables::factory()->activate( 'post' );
101 +
83 102 add_action( 'init', [ $this, 'search_setup' ] );
84 - add_filter( 'ep_sanitize_feature_settings', [ $this, 'sanitize_highlighting_settings' ] );
85 103
86 104 // Set up weighting sub-module
87 105 $this->weighting = new Weighting();
88 106 $this->weighting->setup();
@@ -106,13 +124,17 @@
106 124 add_filter( 'ep_highlighting_tag', [ $this, 'get_highlighting_tag' ] );
107 125 add_action( 'ep_highlighting_pre_add_highlight', [ $this, 'allow_excerpt_html' ] );
108 126
109 127 add_action( 'init', [ $this, 'register_meta' ], 20 );
128 + add_filter( 'ep_prepare_meta_allowed_keys', [ $this, 'add_exclude_from_search' ] );
110 129 add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_assets' ] );
111 130 add_filter( 'ep_post_filters', [ $this, 'exclude_posts_from_search' ], 10, 3 );
112 131 add_action( 'post_submitbox_misc_actions', [ $this, 'output_exclude_from_search_setting' ] );
113 - add_action( 'edit_post', [ $this, 'save_exclude_from_search_meta' ], 10, 2 );
132 + add_action( 'edit_post', [ $this, 'save_exclude_from_search_meta' ] );
114 133 add_filter( 'ep_skip_query_integration', [ $this, 'skip_query_integration' ], 10, 2 );
134 +
135 + add_action( 'attachment_submitbox_misc_actions', [ $this, 'output_exclude_from_search_setting' ], 15 );
136 + add_action( 'edit_attachment', [ $this, 'save_exclude_from_search_meta' ] );
115 137 }
116 138
117 139
118 140 /**
@@ -120,15 +142,9 @@
120 142 */
121 143 public function enqueue_scripts() {
122 144 $settings = $this->get_settings();
123 145
124 - if ( ! $settings ) {
125 - $settings = [];
126 - }
127 -
128 - $settings = wp_parse_args( $settings, $this->default_settings );
129 -
130 - if ( true !== $settings['highlight_enabled'] ) {
146 + if ( '1' !== $settings['highlight_enabled'] ) {
131 147 return;
132 148 }
133 149
134 150 wp_enqueue_style(
@@ -161,15 +177,9 @@
161 177
162 178 // get current config
163 179 $settings = $this->get_settings();
164 180
165 - if ( ! $settings ) {
166 - $settings = [];
167 - }
168 -
169 - $settings = wp_parse_args( $settings, $this->default_settings );
170 -
171 - if ( true !== $settings['highlight_enabled'] ) {
181 + if ( '1' !== $settings['highlight_enabled'] ) {
172 182 return $formatted_args;
173 183 }
174 184
175 185 if ( empty( $args['s'] ) ) {
@@ -245,9 +255,18 @@
245 255 $formatted_args['highlight']['fields'][ $field ] = [
246 256 'pre_tags' => [ $opening_tag ],
247 257 'post_tags' => [ $closing_tag ],
248 258 'type' => 'plain',
249 - 'number_of_fragments' => 0,
259 + /**
260 + * Filter the maximum number of fragments highlighted for a searched field.
261 + *
262 + * @since 4.7.2
263 + * @hook ep_highlight_number_of_fragments
264 + * @param {int} $max_fragments Maximum number of fragments for field.
265 + * @param {string} $field Search field being setup.
266 + * @return {int} New maximum number of fragments to highlight for the searched field.
267 + */
268 + 'number_of_fragments' => apply_filters( 'ep_highlight_number_of_fragments', 0, $field ),
250 269 ];
251 270 }
252 271
253 272 return $formatted_args;
@@ -265,15 +284,9 @@
265 284 }
266 285
267 286 $settings = $this->get_settings();
268 287
269 - if ( ! $settings ) {
270 - $settings = [];
271 - }
272 -
273 - $settings = wp_parse_args( $settings, $this->default_settings );
274 -
275 - if ( ! empty( $settings['highlight_excerpt'] ) && true === $settings['highlight_excerpt'] ) {
288 + if ( ! empty( $settings['highlight_excerpt'] ) && '1' === $settings['highlight_excerpt'] ) {
276 289 remove_filter( 'get_the_excerpt', 'wp_trim_excerpt' );
277 290 add_filter( 'get_the_excerpt', [ $this, 'ep_highlight_excerpt' ], 10, 2 );
278 291 add_filter( 'ep_highlighting_fields', [ $this, 'ep_highlight_add_excerpt_field' ] );
279 292 }
@@ -288,22 +301,20 @@
288 301 *
289 302 * @return string $text the new excerpt
290 303 */
291 304 public function ep_highlight_excerpt( $text, $post ) {
292 -
293 305 $settings = $this->get_settings();
294 306
295 - if ( ! $settings ) {
296 - $settings = [];
297 - }
298 -
299 - $settings = wp_parse_args( $settings, $this->default_settings );
300 -
301 307 // reproduces wp_trim_excerpt filter, preserving the excerpt_more and excerpt_length filters
302 308 if ( '' === $text ) {
303 309 $text = get_the_content( '', false, $post );
310 +
311 + $text = strip_shortcodes( $text );
312 + $text = excerpt_remove_blocks( $text );
313 +
304 314 $text = apply_filters( 'the_content', $text );
305 315 $text = str_replace( '\]\]\>', ']]&gt;', $text );
316 +
306 317 $text = strip_tags( $text, '<' . esc_html( $settings['highlight_tag'] ) . '>' );
307 318
308 319 // use the defined length, if already applied...
309 320 $excerpt_length = apply_filters( 'excerpt_length', 55 );
@@ -309,11 +320,14 @@
309 320 $excerpt_length = apply_filters( 'excerpt_length', 55 );
310 321
311 322 // use defined excerpt_more filter if it is used
312 323 $excerpt_more = apply_filters( 'excerpt_more', $text );
313 -
314 324 $excerpt_more = $excerpt_more !== $text ? $excerpt_more : '[&hellip;]';
315 325
326 + /**
327 + * WordPress would handle this using `wp_trim_words` but that removes all tags,
328 + * including the one used to highlight the search term.
329 + */
316 330 $words = explode( ' ', $text, $excerpt_length + 1 );
317 331 if ( count( $words ) > $excerpt_length ) {
318 332 array_pop( $words );
319 333 array_push( $words, $excerpt_more );
@@ -350,26 +364,8 @@
350 364 return $tag;
351 365 }
352 366
353 367 /**
354 - * Sanitizes our highlighting settings.
355 - *
356 - * @param array $settings Array of current settings
357 - * @return mixed
358 - */
359 - public function sanitize_highlighting_settings( $settings ) {
360 - if ( ! empty( $settings['search']['highlight_excerpt'] ) ) {
361 - $settings['search']['highlight_excerpt'] = (bool) $settings['search']['highlight_excerpt'];
362 - }
363 -
364 - if ( ! empty( $settings['search']['highlight_enabled'] ) ) {
365 - $settings['search']['highlight_enabled'] = (bool) $settings['search']['highlight_enabled'];
366 - }
367 -
368 - return $settings;
369 - }
370 -
371 - /**
372 368 * Returns searchable post types for the current site
373 369 *
374 370 * @since 1.9
375 371 * @return mixed|void
@@ -434,16 +430,10 @@
434 430 * @return bool
435 431 */
436 432 public function is_decaying_enabled( $args = [] ) {
437 433 $settings = $this->get_settings();
438 - $settings = wp_parse_args(
439 - $settings,
440 - [
441 - 'decaying_enabled' => true,
442 - ]
443 - );
444 434
445 - $is_decaying_enabled = (bool) $settings['decaying_enabled'];
435 + $is_decaying_enabled = $settings['decaying_enabled'] && '0' !== $settings['decaying_enabled'];
446 436
447 437 /**
448 438 * Filter to modify decaying
449 439 *
@@ -578,20 +568,8 @@
578 568 return $formatted_args;
579 569 }
580 570
581 571 /**
582 - * Output feature box long text
583 - *
584 - * @since 3.0
585 - */
586 - public function output_feature_box_long() {
587 - ?>
588 - <p><?php esc_html_e( 'Overcome higher-end performance and functional limits posed by the traditional WordPress structured (SQL) database to deliver superior keyword search, instantly. ElasticPress indexes custom fields, tags, and other metadata to improve search results. Fuzzy matching accounts for misspellings and verb tenses.', 'elasticpress' ); ?></p>
589 -
590 - <?php
591 - }
592 -
593 - /**
594 572 * Enable integration on search queries
595 573 *
596 574 * @param bool $enabled Original enabled value
597 575 * @param WP_Query $query WP Query
@@ -627,79 +605,8 @@
627 605 return apply_filters( 'ep_integrate_search_queries', $enabled, $query );
628 606 }
629 607
630 608 /**
631 - * Display decaying settings on dashboard.
632 - *
633 - * @since 2.4
634 - */
635 - public function output_feature_box_settings() {
636 - $settings = $this->get_settings();
637 -
638 - if ( ! $settings ) {
639 - $settings = [];
640 - }
641 -
642 - $settings = wp_parse_args( $settings, $this->default_settings );
643 -
644 - ?>
645 - <div class="field">
646 - <div class="field-name status"><?php esc_html_e( 'Weight results by date', 'elasticpress' ); ?></div>
647 - <div class="input-wrap">
648 - <label><input name="settings[decaying_enabled]" type="radio" <?php checked( (bool) $settings['decaying_enabled'] ); ?> value="1"><?php esc_html_e( 'Enabled', 'elasticpress' ); ?></label><br>
649 - <label><input name="settings[decaying_enabled]" type="radio" <?php checked( ! (bool) $settings['decaying_enabled'] ); ?> value="0"><?php esc_html_e( 'Disabled', 'elasticpress' ); ?></label><br>
650 - <?php
651 - /**
652 - * Fires after the default Weight results by date settings
653 - *
654 - * @since 4.6.0
655 - * @hook ep_weight_settings_after_search
656 - * @param {array} $settings settings array
657 - */
658 - do_action( 'ep_weight_settings_after_search', $settings );
659 - ?>
660 - </div>
661 - </div>
662 - <div class="field">
663 - <div class="field-name status"><?php esc_html_e( 'Highlighting status', 'elasticpress' ); ?></div>
664 - <div class="input-wrap">
665 - <label><input name="settings[highlight_enabled]" type="radio" <?php checked( (bool) $settings['highlight_enabled'] ); ?> value="1"><?php esc_html_e( 'Enabled', 'elasticpress' ); ?></label><br>
666 - <label><input name="settings[highlight_enabled]" type="radio" <?php checked( ! (bool) $settings['highlight_enabled'] ); ?> value="0"><?php esc_html_e( 'Disabled', 'elasticpress' ); ?></label>
667 - <p class="field-description"><?php esc_html_e( 'Wrap search terms in HTML tags in results for custom styling. The wrapping HTML tag comes with the "ep-highlight" class for easy styling.' ); ?></p>
668 - </div>
669 - </div>
670 - <div class="field">
671 - <label for="highlight-tag" class="field-name status"><?php echo esc_html_e( 'Highlight tag ', 'elasticpress' ); ?></label>
672 - <div class="input-wrap">
673 - <select id="highlight-tag" name="settings[highlight_tag]">
674 - <?php
675 - foreach ( self::$default_highlight_tags as $option ) :
676 - echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $settings['highlight_tag'] ) . '>' . esc_html( $option ) . '</option>';
677 - endforeach;
678 - ?>
679 - </select>
680 - </div>
681 - </div>
682 -
683 - <div class="field">
684 - <div class="field-name status"><?php esc_html_e( 'Excerpt highlighting', 'elasticpress' ); ?></div>
685 - <div class="input-wrap">
686 - <label><input name="settings[highlight_excerpt]" type="radio" <?php checked( (bool) $settings['highlight_excerpt'] ); ?> value="1"><?php esc_html_e( 'Enabled', 'elasticpress' ); ?></label><br>
687 - <label><input name="settings[highlight_excerpt]" type="radio" <?php checked( ! (bool) $settings['highlight_excerpt'] ); ?> value="0"><?php esc_html_e( 'Disabled', 'elasticpress' ); ?></label>
688 - <p class="field-description"><?php esc_html_e( 'By default, WordPress strips HTML from content excerpts. Enable when using the_excerpt() to display search results. ', 'elasticpress' ); ?></p>
689 - </div>
690 - </div>
691 -
692 - <?php if ( ! defined( 'EP_IS_NETWORK' ) || ! EP_IS_NETWORK ) : ?>
693 - <br class="clear">
694 - <p><a href="<?php echo esc_url( admin_url( 'admin.php?page=elasticpress-weighting' ) ); ?>"><?php esc_html_e( 'Advanced fields and weighting settings', 'elasticpress' ); ?></a></p>
695 - <p><a href="<?php echo esc_url( admin_url( 'admin.php?page=elasticpress-synonyms' ) ); ?>"><?php esc_html_e( 'Add synonyms to your post searches', 'elasticpress' ); ?></a></p>
696 - <?php endif; ?>
697 -
698 - <?php
699 - }
700 -
701 - /**
702 609 * Registers post meta for exclude from search feature.
703 610 */
704 611 public function register_meta() {
705 612 register_post_meta(
@@ -713,8 +620,20 @@
713 620 );
714 621 }
715 622
716 623 /**
624 + * Add ep_exclude_from_search to the allowed meta fields list.
625 + *
626 + * @since 5.0.0
627 + * @param array $keys List of allowed meta fields
628 + * @return array
629 + */
630 + public function add_exclude_from_search( $keys ) {
631 + $keys[] = 'ep_exclude_from_search';
632 + return $keys;
633 + }
634 +
635 + /**
717 636 * Enqueue block editor assets.
718 637 */
719 638 public function enqueue_block_editor_assets() {
720 639 global $post;
@@ -722,15 +641,21 @@
722 641 if ( ! $post instanceof \WP_Post ) {
723 642 return;
724 643 }
725 644
645 + if ( ! $post->post_type || ! post_type_supports( $post->post_type, 'custom-fields' ) ) {
646 + return;
647 + }
648 +
726 649 wp_enqueue_script(
727 650 'ep-search-editor',
728 - EP_URL . '/dist/js/search-editor-script.js',
651 + EP_URL . 'dist/js/search-editor-script.js',
729 652 Utils\get_asset_info( 'search-editor-script', 'dependencies' ),
730 653 Utils\get_asset_info( 'search-editor-script', 'version' ),
731 654 true
732 655 );
656 +
657 + wp_set_script_translations( 'ep-search-editor', 'elasticpress' );
733 658 }
734 659
735 660 /**
736 661 * Exclude posts based on ep_exclude_from_search post meta.
@@ -739,9 +664,14 @@
739 664 * @param array $args WP Query args
740 665 * @param WP_Query $query WP Query object
741 666 */
742 667 public function exclude_posts_from_search( $filters, $args, $query ) {
743 - $bypass_exclusion_from_search = is_admin() || ! $query->is_search();
668 + if ( ! empty( $query->get( 'ep_skip_search_exclusion' ) ) ) {
669 + return $filters;
670 + }
671 +
672 + $bypass_exclusion_from_search = ( is_admin() && ! wp_doing_ajax() ) || ! $query->is_search();
673 +
744 674 /**
745 675 * Filter whether the exclusion from the "exclude from search" checkbox should be applied
746 676 *
747 677 * @since 4.4.0
@@ -749,9 +679,14 @@
749 679 * @param {bool} $bypass_exclusion_from_search True means all posts will be returned
750 680 * @param {WP_Query} $query WP Query
751 681 * @return {bool} New $bypass_exclusion_from_search value
752 682 */
753 - if ( apply_filters( 'ep_bypass_exclusion_from_search', $bypass_exclusion_from_search, $query ) ) {
683 + if ( apply_filters_deprecated(
684 + 'ep_bypass_exclusion_from_search',
685 + [ $bypass_exclusion_from_search, $query ],
686 + 'ElasticPress 5.3.0',
687 + 'WP_Query->ep_skip_search_exclusion argument'
688 + ) ) {
754 689 return $filters;
755 690 }
756 691
757 692 $filters[] = [
@@ -774,9 +709,8 @@
774 709 *
775 710 * @param WP_POST $post Post object.
776 711 */
777 712 public function output_exclude_from_search_setting( $post ) {
778 -
779 713 $searchable_post_types = $this->get_searchable_post_types();
780 714 if ( ! in_array( $post->post_type, $searchable_post_types, true ) ) {
781 715 return;
782 716 }
@@ -783,9 +717,15 @@
783 717 ?>
784 718 <div class="misc-pub-section">
785 719 <input id="ep_exclude_from_search" name="ep_exclude_from_search" type="checkbox" value="1" <?php checked( get_post_meta( get_the_ID(), 'ep_exclude_from_search', true ) ); ?>>
786 720 <label for="ep_exclude_from_search"><?php esc_html_e( 'Exclude from search results', 'elasticpress' ); ?></label>
787 - <p class="howto"><?php esc_html_e( 'Excludes this post from the results of your site\'s search form while ElasticPress is active.', 'elasticpress' ); ?></p>
721 + <p class="howto">
722 + <?php if ( 'attachment' === $post->post_type ) : ?>
723 + <?php esc_html_e( 'Excludes this media from the results of your site\'s search form while ElasticPress is active.', 'elasticpress' ); ?>
724 + <?php else : ?>
725 + <?php esc_html_e( 'Excludes this post from the results of your site\'s search form while ElasticPress is active.', 'elasticpress' ); ?>
726 + <?php endif; ?>
727 + </p>
788 728 <?php wp_nonce_field( 'save-exclude-from-search', 'ep-exclude-from-search-nonce' ); ?>
789 729 </div>
790 730 <?php
791 731 }
@@ -792,13 +732,11 @@
792 732
793 733 /**
794 734 * Saves exclude from search meta.
795 735 *
796 - * @param int $post_id The post ID.
797 - * @param WP_Post $post Post object.
736 + * @param int $post_id The post ID.
798 737 */
799 - public function save_exclude_from_search_meta( $post_id, $post ) {
800 -
738 + public function save_exclude_from_search_meta( $post_id ) {
801 739 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
802 740 return;
803 741 }
804 742
@@ -809,11 +747,13 @@
809 747 if ( ! current_user_can( 'edit_post', $post_id ) ) {
810 748 return;
811 749 }
812 750
813 - $exclude_from_search = isset( $_POST['ep_exclude_from_search'] ) ? true : false;
814 -
815 - update_post_meta( $post_id, 'ep_exclude_from_search', $exclude_from_search );
751 + if ( isset( $_POST['ep_exclude_from_search'] ) ) {
752 + update_post_meta( $post_id, 'ep_exclude_from_search', true );
753 + } else {
754 + delete_post_meta( $post_id, 'ep_exclude_from_search' );
755 + }
816 756 }
817 757
818 758 /**
819 759 * If WP_Query has unsupported orderby, skip ES query integration and use the WP query instead.
@@ -847,6 +787,109 @@
847 787 return true;
848 788 }
849 789
850 790 return $skip;
791 + }
792 +
793 + /**
794 + * Set the `settings_schema` attribute
795 + *
796 + * @since 5.0.0
797 + */
798 + protected function set_settings_schema() {
799 + $this->settings_schema = [
800 + [
801 + 'default' => '1',
802 + 'key' => 'decaying_enabled',
803 + 'label' => __( 'Weighting by date', 'elasticpress' ),
804 + 'options' => [
805 + [
806 + 'label' => __( 'Don\'t weight results by date', 'elasticpress' ),
807 + 'value' => '0',
808 + ],
809 + [
810 + 'label' => __( 'Weight results by date', 'elasticpress' ),
811 + 'value' => '1',
812 + ],
813 + ],
814 + 'type' => 'radio',
815 + ],
816 + [
817 + 'default' => '0',
818 + 'help' => __( 'Enable to wrap search terms in HTML tags in results for custom styling. The wrapping HTML tag comes with the <code>ep-highlight</code> class for easy styling.', 'elasticpress' ),
819 + 'key' => 'highlight_enabled',
820 + 'label' => __( 'Highlight search terms', 'elasticpress' ),
821 + 'type' => 'checkbox',
822 + 'field_group_slug' => 'highlight_group',
823 + ],
824 + [
825 + 'default' => '0',
826 + 'help' => __( 'By default, WordPress strips HTML from content excerpts. Enable when using <code>the_excerpt()</code> to display search results.', 'elasticpress' ),
827 + 'key' => 'highlight_excerpt',
828 + 'label' => __( 'Highlight search terms in excerpts', 'elasticpress' ),
829 + 'type' => 'checkbox',
830 + 'field_group_slug' => 'highlight_group',
831 + ],
832 + [
833 + 'default' => 'mark',
834 + 'help' => __( 'Select the HTML tag used to highlight search terms.', 'elasticpress' ),
835 + 'key' => 'highlight_tag',
836 + 'label' => __( 'Highlight tag', 'elasticpress' ),
837 + 'options' => [
838 + [
839 + 'label' => 'mark',
840 + 'value' => 'mark',
841 + ],
842 + [
843 + 'label' => 'span',
844 + 'value' => 'span',
845 + ],
846 + [
847 + 'label' => 'strong',
848 + 'value' => 'strong',
849 + ],
850 + [
851 + 'label' => 'em',
852 + 'value' => 'em',
853 + ],
854 + [
855 + 'label' => 'i',
856 + 'value' => 'i',
857 + ],
858 + ],
859 + 'type' => 'select',
860 + 'requires_fields' => [
861 + 'relationship' => 'OR',
862 + 'conditions' => [
863 + 'highlight_enabled' => '1',
864 + 'highlight_excerpt' => '1',
865 + ],
866 + ],
867 + 'field_group_slug' => 'highlight_group',
868 + ],
869 + [
870 + 'default' => 'simple',
871 + 'key' => 'synonyms_editor_mode',
872 + 'type' => 'hidden',
873 + ],
874 + ];
875 +
876 + if ( ! defined( 'EP_IS_NETWORK' ) || ! EP_IS_NETWORK ) {
877 + $weighting_url = esc_url( admin_url( 'admin.php?page=elasticpress-weighting' ) );
878 + $synonyms_url = esc_url( admin_url( 'admin.php?page=elasticpress-synonyms' ) );
879 +
880 + $text = sprintf(
881 + '<p><a href="%1$s">%2$s</a></p><p><a href="%3$s">%4$s</a></p>',
882 + $weighting_url,
883 + __( 'Advanced fields and weighting settings', 'elasticpress' ),
884 + $synonyms_url,
885 + __( 'Add synonyms to your post searches', 'elasticpress' ),
886 + );
887 +
888 + $this->settings_schema[] = [
889 + 'key' => 'additional_links',
890 + 'label' => $text,
891 + 'type' => 'markup',
892 + ];
893 + }
851 894 }
852 895 }