Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created March 26, 2020 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/38f9528194a3b2c0bb4417939ee861af to your computer and use it in GitHub Desktop.
Save jchristopher/38f9528194a3b2c0bb4417939ee861af to your computer and use it in GitHub Desktop.
Customize available Engine Source Attribute weights in SearchWP
<?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',
];
} );
@TriOptCorp
Copy link

Hi,

Ok, if we put this code in, what does it do? Does it add a field in the search engine where weights can be assigned? Please give further details / explanation. For example, if I wanted to give the following weights to the following, how would I do that?

100 - pages
90 - blog posts
80 - custom posts

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment