Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active August 29, 2015 14:03
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/635c8a849cc469be6719 to your computer and use it in GitHub Desktop.
Save jchristopher/635c8a849cc469be6719 to your computer and use it in GitHub Desktop.
SearchWP 2.3 will make available all of the weights that dictated the order of search results
<?php
print_r( SWP()->results_weights );
/* ===================== OUTPUT =====================
Primary array key is the $post->ID, each primary value contains the overall
weight for that $post in addition to the weight for each post type
Array
(
[1778] => Array
(
[post_id] => 1778
[weight] => 100
[post_types] => Array
(
[post] => 100
[page] => 0
[cpt1] => 0
[attachment] => 0
)
)
[801] => Array
(
[post_id] => 801
[weight] => 80
[post_types] => Array
(
[post] => 80
[page] => 0
[cpt1] => 0
[attachment] => 0
)
)
[2424] => Array
(
[post_id] => 2424
[weight] => 60
[post_types] => Array
(
[post] => 60
[page] => 0
[cpt1] => 0
[attachment] => 0
)
)
)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment