{"action":"closed","issue":{"url":"https://api.github.com/repos/10up/ElasticPress/issues/318","labels_url":"https://api.github.com/repos/10up/ElasticPress/issues/318/labels{/name}","comments_url":"https://api.github.com/repos/10up/ElasticPress/issues/318/comments","events_url":"https://api.github.com/repos/10up/ElasticPress/issues/318/events","html_url":"https://github.com/10up/ElasticPress/issues/318","id":96254493,"number":318,"title":"Adding content from Advanced Custom Fields to search index","user":{"login":"fschroiff","id":660010,"avatar_url":"https://avatars.githubusercontent.com/u/660010?v=3","gravatar_id":"","url":"https://api.github.com/users/fschroiff","html_url":"https://github.com/fschroiff","followers_url":"https://api.github.com/users/fschroiff/followers","following_url":"https://api.github.com/users/fschroiff/following{/other_user}","gists_url":"https://api.github.com/users/fschroiff/gists{/gist_id}","starred_url":"https://api.github.com/users/fschroiff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fschroiff/subscriptions","organizations_url":"https://api.github.com/users/fschroiff/orgs","repos_url":"https://api.github.com/users/fschroiff/repos","events_url":"https://api.github.com/users/fschroiff/events{/privacy}","received_events_url":"https://api.github.com/users/fschroiff/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-21T08:03:52Z","updated_at":"2015-07-22T09:07:13Z","closed_at":"2015-07-22T09:07:13Z","body":"I am trying to add content from some of my custom fields to the search index and failing. What am I missing?\r\n\r\n````php\r\nfunction update_ep_sync_args( $post_args, $post_id ) {\r\n    $oldPreparedMeta = $post_args[ 'post_meta' ];\r\n    $additionalPreparedMeta = array();\r\n    $post = get_post( $post_id );\r\n    if( have_rows('content',$post->ID) ):\r\n        // loop through the rows of data\r\n        while ( have_rows('content',$post->ID) ) : the_row();\r\n        // BODY TEXT\r\n            if( get_row_layout() == 'text' ):\r\n                $additionalPreparedMeta['text'] = get_sub_field('text') . ' ';\r\n            elseif( get_row_layout() == 'subHeading' ):\r\n                $text = get_sub_field('text');\r\n                $additionalPreparedMeta['text'] = $text . ' ';\r\n            endif;\r\n        endwhile;\r\n    endif;\r\n    $newPreparedMeta = array_merge( $oldPreparedMeta, $additionalPreparedMeta );\r\n    $post_args[ 'post_meta' ] = $newPreparedMeta;\r\n    return $post_args;\r\n}\r\nadd_filter( 'ep_post_sync_args', 'update_ep_sync_args', 10, 2 );\r\n````\r\n\r\nThere's a modest bounty for whomever answers [this question on StackExchange](http://wordpress.stackexchange.com/q/194785/10595)."}}