Skip to content

Commit 1b31708

Browse files
author
Marco Pereirinha
committed
Preventing getting a random post in an archive page
1 parent 3dcdbf7 commit 1b31708

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

php/media/class-global-transformations.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,13 @@ protected function get_current_post() {
576576
*
577577
* @return {WP_Post|null}
578578
*/
579-
return get_post( apply_filters( 'cloudinary_post_id', null ) );
579+
$post_id = apply_filters( 'cloudinary_post_id', null );
580+
581+
if ( is_null( $post_id ) ) {
582+
return null;
583+
}
584+
585+
return get_post( $post_id );
580586
}
581587

582588
/**

0 commit comments

Comments
 (0)