SHARE
TWEET

Adding Titles and Captions to Relevanssi Index

a guest Jun 6th, 2016 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('relevanssi_content_to_index', 'add_extra_content', 10, 2);
  2. function add_extra_content($content, $post) {
  3.     $images = get_field_object('gallery', $post->ID);
  4.     if($images){
  5.         foreach( $images as $image ) {
  6.             $content .= " " . $image['title'];
  7.             $content .= " " . $image['caption'];
  8.         }
  9.         return $content;
  10.     }
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top