this code may help you
$status = get_option('comment_registration');
// 1 : Yes , user must be registered and logged in for commenting
// 0 : No (default)
You can use the following code for the comment section
if (comments_open($postId)) {
if (get_option('comment_registration') == 0 || is_user_logged_in() ){
//render comments section
}else{
echo "You must login first";
}
}else{
echo "comments are closed";
}
also you can see other options in https://codex.wordpress.org/Option_Reference
Related Posts:
- How to limit users to one comment per post
- Get all commenters on a post
- How to edit user_id on the comment edit screen
- User capability for editing their own comments
- Custom Comment Notifications Fire on each Page Load
- Author comment count in author page
- How to auto-generate names for guest users who leave comments?
- How to limit specific user ID to 5 comments per post?
- How can i display pagination in custom comment list?
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- What’s the difference between the capability remove_users and delete_users?
- How to change user_login with wp-cli?
- Replacing the WordPress password validation
- alphabetically order role drop-down selection in dashboard
- WordPress auto login after registration not working
- Change the author slug from nickname to ID
- How to hide media uploads by other users in the Media menu?
- Retrieve all users from wordpress database via REST/JSON API
- Get users with atleast one post
- edit profile validation refreshes all field if missing wordpress
- How to order users alphabetically by their last name?
- How to use hyperdb to separate and share a user dataset between wordpress installs?
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- pre_user_query meta_query admin user list
- Plugin to require Twitter or Facebook login before posting a comment [closed]
- Return ID of authors who have at least one post
- How to list users that have written custom post types and hide the ones that have not?
- Front end user meta options for users
- Find out when a user was created and display varied content depending on time since creation
- Drop down list in user profile page
- How can I link users across multiple subdomains?
- Importing Existing Users with Passwords
- Create not-activated user in code, wordpress
- How to add user meta for all users
- Is there any function available to echo current user’s profile url?
- How can I allow users to sign up but prevent them from accessing the WordPress backend?
- Get User Role by ID not working
- Display the number of unseen comments on a page since the user last visit
- How to delete all post and attachments of a user when I delete it?
- Redirect user to login before viewing custom post
- Force user to change their password on first log in of site using shortcode
- How to export bbPress (forums, topics, replies) and all users?
- Display users in order by an “order” custom meta field
- Translate emails into the language of the user
- C# user_nicename and Display name blank
- WP users page doesn’t show users count by role
- Can I check which users ran which updates?
- Extend backend User search to custom user meta
- Move users and passwords from one wordpress site to another
- Failed login attempts
- How to implement friend system for WordPress?
- Delete user after Contact Form 7 submission [closed]
- Best way to get user id for get_users function?
- How to hide user profile fields based on the role of the viewed user?
- user_meta table in staging vs live site
- Get usermeta info from sql query
- redirect user to their profile after log in
- Get current user array into hyperlink
- Privilege to recover trashed posts
- One Click Access To Users Account In WordPress?
- how do I add role and capability after I create a new user
- Get Authors Role
- How to use `wp_insert_user` & `wp_insert_post` simultaneously without `headers already sent` error?
- Unexpected problems after importing WP data
- Changing user of post by changing ‘post_author’ field in ‘wp_posts’ table not taking effect. Where is the real post author info kept?
- Edit text of WordPress “Register” button
- WordPress user role with create user capability?
- How to safely trigger password reset emails for thousands of users
- How to add extra field in profile page and show in myaccount?
- Perform multiple actions after wp_insert_user()
- My custom user metadata is only active for only admin but i want it to be active on all users especially customers
- SQL to set Display Name to First Name + Last Name
- how to retrieve user via rest api using custom meta and/or email
- How to customize user rest api?
- User Group Level Login
- Hook into add_user_role and update based on new and removed roles
- REST API list_user
- meta_query orderby sort multiple keys
- How to update user meta from php file?
- Updated user role inncorrect when using wp_get_current_user()
- Custom registration fields not appearing in user info
- Grab user_id inside a function
- Show user details only
- Output checkbox per user and save in plugin options
- Require confirmation of current user’s email before updating database and before send_email_change_email
- get_user_by asking for string while string is given
- How do I change the user via SQL?
- post acces for guests / unregistered users only
- Track users views
- user added by(who added this user)
- User list order by user meta
- What’s the most secure way to grant a user permission to update in a multisite?
- User email not being changed (cached?) until next page load (frontend)
- logged_in user outside of wordpress loop
- Modify Profile Biographical Info Field
- Problem with update_user_meta() meta_value
- Show only users with the same role in Dashboard user list
- Add custom input field in new user page
- Remove My Account Menu items in Woocommerce based on user roles