This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use ElasticPress\Indexables as Indexables; | |
| add_filter( 'ep_post_sync_args_post_prepare_meta', function ( $post_args, $post_id ) { | |
| $noindex = get_post_meta( $post_id, '_yoast_wpseo_meta-robots-noindex', true ); | |
| if ( 1 === absint( $noindex ) ) { | |
| Indexables::factory()->get( 'post' )->delete( $post_id, false ); | |
| return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Generate excerpt from returned content from ElasticPress. | |
| */ | |
| function ep_excerpt( $excerpt ) { | |
| global $post; | |
| if ( ! isset( $post->elasticsearch ) ) { | |
| return $excerpt; | |
| } | |
| $excerpt_length = apply_filters( 'excerpt_length', 55 ); |