Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active August 29, 2015 14:23
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/01e79bef22e2ec137f29 to your computer and use it in GitHub Desktop.
Save jchristopher/01e79bef22e2ec137f29 to your computer and use it in GitHub Desktop.
<?php
// Add to your theme's functions.php
add_filter( 'searchwp_indexed_post_types', 'my_searchwp_indexed_post_types' );
add_filter( 'searchwp_engine_settings_default', 'my_searchwp_engine_settings_default', 10, 2 );
function my_searchwp_indexed_post_types( $post_types ) {
if ( ! in_array( 'attachment', $post_types ) ) {
$post_types[] = 'attachment';
}
return $post_types;
}
function my_searchwp_engine_settings_default( $settings, $query ) {
$settings['attachment']['enabled'] = true;
$settings['attachment']['weights']['title'] = 20;
return $settings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment