Skip to content

Commit 68bb544

Browse files
committed
fix: default post ID
1 parent 07ae0fa commit 68bb544

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

includes/content-gate/class-content-restriction-control.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,12 @@ public static function is_post_restricted( $is_post_restricted, $post_id = null
194194
* Get the current gate post ID.
195195
*
196196
* @param int $gate_post_id Gate post ID.
197-
* @param int $post_id Post ID.
197+
* @param int $post_id Post ID. If not given, uses the current post ID.
198198
*
199199
* @return int|false
200200
*/
201201
public static function get_gate_post_id( $gate_post_id, $post_id = null ) {
202+
$post_id = $post_id ?? \get_the_ID();
202203
if ( ! empty( self::$post_gate_id_map[ $post_id ] ) ) {
203204
return self::$post_gate_id_map[ $post_id ];
204205
}

0 commit comments

Comments
 (0)