Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'pre_comment_on_post', 'wpq_pre_commenting' );
- function wpq_pre_commenting( $pid ) {
- $parent_id = filter_input( INPUT_POST, 'comment_parent', FILTER_SANITIZE_NUMBER_INT );
- $post = get_post( $pid );
- $cuid = get_current_user_id();
- if( ! is_null( $post ) && $post->post_author == $cuid && 0 == $parent_id ) {
- wp_die( 'Sorry, post author can only reply to a comment!' );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement