Skip to content

Commit f140c1a

Browse files
committed
remove the "webmentions_closed" meta value if the post is updated
1 parent 0681b06 commit f140c1a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

webmention.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ function init() {
150150
remove_action( 'admin_init', array( 'Semantic_Linkbacks_Plugin', 'admin_init' ) );
151151

152152
add_action( 'wp_enqueue_scripts', '\Webmention\enqueue_scripts' );
153+
154+
// remove the "webmentions_closed" meta value if the post is updated
155+
\add_action(
156+
'updated_postmeta',
157+
function ( $meta_id, $object_id, $meta_key, $meta_value ) {
158+
if ( 'webmentions_closed' === $meta_key && empty( $meta_value ) ) {
159+
\delete_post_meta( $object_id, 'webmentions_closed' );
160+
}
161+
}
162+
);
153163
}
154164
add_action( 'plugins_loaded', '\Webmention\init' );
155165

0 commit comments

Comments
 (0)