SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

searchwp\weights

Since: 4.0.0

Table of Contents

Customize the weight intervals available when configuring SearchWP Engine Source Attributes.

Parameters

Type Parameter Default Since
Array $weights Array keys are integers representing weight, value is the label of the weight 4.0.0

Examples

All hooks should be added to your custom SearchWP Customizations Plugin.

Customize available Engine Source Attribute weights

<?php
// Customize available Engine Source Attribute weights in SearchWP.
add_filter( 'searchwp\weights', function( $weights ) {
// Make available only two weight choices.
return [
1 => 'Lowest',
1000 => 'Highest',
];
} );

How to use this code