Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

Commit

Permalink
fix(indexing): send un-escaped content to Algolia
Browse files Browse the repository at this point in the history
Closes: #615
  • Loading branch information
rayrutjes committed Jul 17, 2017
1 parent 913996b commit f89fefe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/indices/class-algolia-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ protected function get_records( $item ) {
private function get_post_records( WP_Post $post ) {
$shared_attributes = $this->get_post_shared_attributes( $post );

$removed = remove_filter( 'the_content', 'wptexturize', 10 );

$post_content = apply_filters( 'the_content', $post->post_content );

if ( $removed === true ) {
add_filter( 'the_content', 'wptexturize', 10 );
}

$post_content = Algolia_Utils::prepare_content( $post_content );
$parts = Algolia_Utils::explode_content( $post_content );

Expand Down
7 changes: 7 additions & 0 deletions includes/indices/class-algolia-searchable-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ protected function get_records( $item ) {
private function get_post_records( WP_Post $post ) {
$shared_attributes = $this->get_post_shared_attributes( $post );

$removed = remove_filter( 'the_content', 'wptexturize', 10 );

$post_content = apply_filters( 'the_content', $post->post_content );

if ( $removed === true ) {
add_filter( 'the_content', 'wptexturize', 10 );
}

$post_content = Algolia_Utils::prepare_content( $post_content );
$parts = Algolia_Utils::explode_content( $post_content );

Expand Down

0 comments on commit f89fefe

Please sign in to comment.