Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created May 30, 2023 16:27
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 searchwpgists/edc68e5d2084aed89c89ede635f1bc98 to your computer and use it in GitHub Desktop.
Save searchwpgists/edc68e5d2084aed89c89ede635f1bc98 to your computer and use it in GitHub Desktop.
SearchWP Related default arguments for getter
<?php
// Use the saved keywords from the meta box
$keywords = get_post_meta( get_the_ID(), $searchwp_related->meta_key, true );
$defaults = array(
'engine' => 'default', // Engine to use
's' => $keywords, // Terms to search
'fields' => 'all', // Return post objects, use 'ids' to return IDs
'posts_per_page' => 3, // How many results to return
'log' => false, // Log the search?
'post__in' => array(), // Limit results pool?
'post__not_in' => array() // Exclude posts from results?
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment