Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created March 29, 2022 12:54
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/0efeff93ae37ff6ddb16ebe8e3186e7e to your computer and use it in GitHub Desktop.
Save searchwpgists/0efeff93ae37ff6ddb16ebe8e3186e7e to your computer and use it in GitHub Desktop.
Use a custom text file parser to extract content in SearchWP
<?php
// Use a custom text file parser to extract content in SearchWP.
add_filter( 'searchwp\parser\text', function( $content, $data ) {
$my_parser = new \MyTextParser( $data['file'] );
return $my_parser->text();
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment