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

Add filter to post thumbnail ID #829

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions includes/class-algolia-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ public static function get_post_images( $post_id ) {
$post_thumbnail_id = get_post_thumbnail_id( (int) $post_id );
}

/**
* Filter the post thumbnail ID.
*
* @since 2.11.4
*
* @param int $post_thumbnail_id The post thumbnail ID.
* @param int $post_id The post ID.
*
* @return int
*/
$post_thumbnail_id = (int) apply_filters( 'algolia_post_thumbnail_id', $post_thumbnail_id, (int) $post_id );

if ( $post_thumbnail_id ) {
$sizes = (array) apply_filters( 'algolia_post_images_sizes', array( 'thumbnail' ) );
foreach ( $sizes as $size ) {
Expand Down