Skip to content

Commit 310a310

Browse files
committed
add better check
1 parent 22625c6 commit 310a310

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

includes/functions.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,14 +555,19 @@ function webmentions_open( $post = null ) {
555555
$open = false;
556556
if ( $post ) {
557557
// Always consider the home mention link page to be open.
558-
if ( get_option( 'webmention_home_mentions' ) === $post->ID ) {
558+
if ( \get_option( 'webmention_home_mentions' ) === $post->ID ) {
559559
$open = true;
560-
} elseif ( ! post_type_supports( get_post_type( $post ), 'webmentions' ) ) {
560+
} elseif ( ! \post_type_supports( \get_post_type( $post ), 'webmentions' ) ) {
561561
// If the post type does not support Webmentions do not even check further.
562562
$open = false;
563563
} else {
564-
// If the webmentions_disabled meta key exists then consider webmentions closed. Otherwise consider them open.
565-
$open = ! ( metadata_exists( 'post', $post_id, 'webmentions_disabled' ) ); // Invert the result, as exists is closed and not exists is open.
564+
$disabled = \get_post_meta( $post_id, 'webmentions_disabled', true );
565+
566+
if ( '1' === $disabled ) {
567+
$open = false;
568+
} else {
569+
$open = true;
570+
}
566571
}
567572
}
568573

0 commit comments

Comments
 (0)