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

Commit

Permalink
feat(indexing): allow to filter post content attribute
Browse files Browse the repository at this point in the history
Closes: #680
  • Loading branch information
rayrutjes committed Oct 24, 2017
1 parent 8f0af10 commit f599054
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion includes/indices/class-algolia-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ private function get_post_records( WP_Post $post ) {

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

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

if ( $removed === true ) {
add_filter( 'the_content', 'wptexturize', 10 );
Expand Down
10 changes: 4 additions & 6 deletions includes/indices/class-algolia-searchable-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,11 @@ 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 );
$removed = remove_filter( 'the_content', 'wptexturize', 10 );

if ( !empty( $shared_attributes[ 'content' ] ) ) {
$post_content .= apply_filters( 'the_content', $shared_attributes[ 'content' ] );
}

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

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

0 comments on commit f599054

Please sign in to comment.