{"id":408,"date":"2021-12-28T17:48:30","date_gmt":"2021-12-28T12:18:30","guid":{"rendered":"https:\/\/hostkicker.com\/blog\/?p=408"},"modified":"2022-05-19T14:37:13","modified_gmt":"2022-05-19T09:07:13","slug":"force-users-to-login-in-wordpress","status":"publish","type":"post","link":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/","title":{"rendered":"How To Force Users To Login in WordPress"},"content":{"rendered":"<p><span data-preserver-spaces=\"true\">Suppose you want to create a WordPress website but don&#8217;t want it to be available for everyone. Maybe you want to build a member-only platform where some members or subscribers of your site can log in to it, Or maybe your blog has unique content that you want to make available for registered\/paid users only. Then you have to find how to force users to login to WordPress.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">When you force a login to WordPress, you tell the users that you can only see the content of that particular site if they login to the website. <\/span><span data-preserver-spaces=\"true\">However, A force login for a user does not mean that they have admin or editor access to your website. It only means that users log in as a member-only to get the content.<\/span><\/p>\n<p><strong>Few Reasons Why You Require to log in to a Page\/Website<\/strong><\/p>\n<p><span data-preserver-spaces=\"true\">There can be many reasons you require to log in to a page or website. Some explanations are below.\u00a0<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">Maybe you have a private blog or website you don&#8217;t want to share with everyone. Suppose you are working on a project that is not ready, and you want to restrict it. Therefore, Only specific people could log in to it.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">If you own a membership website and want to allow a particular member to a specific page, they must log in to view them.<\/span><\/li>\n<li><span data-preserver-spaces=\"true\">If you offer paid online courses or content, you have to protect the site from non-users. Users have to become paid members of that site and create their accounts to log in.<\/span><\/li>\n<\/ul>\n<p><span data-preserver-spaces=\"true\">To force a login in WordPress, you can either use some code or use a plugin. Also, you can use some different PHP codes for specific situations.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">Below are the methods explained.<\/span><\/p>\n<h2>#Methods to force users to login WordPress<\/h2>\n<h3><span data-preserver-spaces=\"true\">1.By using The Force Login plugin<\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-425\" src=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Force-Login-Plugin.png\" alt=\"\" width=\"1024\" height=\"456\" srcset=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Force-Login-Plugin.png 1024w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Force-Login-Plugin-300x134.png 300w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Force-Login-Plugin-768x342.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><span data-preserver-spaces=\"true\">First, we are using the plugin method. This plugin is straightforward to use. It helps you to hide your WordPress website from public viewing. Visitors need to log in to visit your site.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">You can Install and activate the plugin by using our<a href=\"https:\/\/hostkicker.com\/blog\/how-to-install-a-wordpress-plugin\"> guide<\/a> or by simply f<\/span><span data-preserver-spaces=\"true\">ollowing the below steps:<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">Go to Plugin &gt;&gt; Add new &gt;&gt; search for Force Login plugin.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-426\" src=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Install-Activate-Force-Login.png\" alt=\"\" width=\"1024\" height=\"456\" srcset=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Install-Activate-Force-Login.png 1024w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Install-Activate-Force-Login-300x134.png 300w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Install-Activate-Force-Login-768x342.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><span data-preserver-spaces=\"true\">You are done! Good to go. You don&#8217;t have to do further settings as this plugin is automatically turned on.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">If someone tries to go to your website or any URL on your site, they will directly reach the login page for your website. Here, they can log in with their details to get the content.<\/span><\/p>\n<h3><strong><span data-preserver-spaces=\"true\">2.By using some coding tricks<\/span><\/strong><\/h3>\n<p><span data-preserver-spaces=\"true\">We can use some codes to force Login in different situations. You have to access your function.php file and add the code.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">The codes are for the relevant situation. You can use whatever you want.<\/span><\/p>\n<ul>\n<li><span data-preserver-spaces=\"true\">Go to Appearance &gt;&gt; Theme Editor\u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-427\" src=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Appearance-Theme-Editor.png\" alt=\"\" width=\"1024\" height=\"456\" srcset=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Appearance-Theme-Editor.png 1024w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Appearance-Theme-Editor-300x134.png 300w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Appearance-Theme-Editor-768x342.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/li>\n<li><span data-preserver-spaces=\"true\">click on theme functions (function.php) &gt;&gt; use any code &gt;&gt; save<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-428\" src=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Theme-Functions-Functions-PHP.png\" alt=\"\" width=\"1024\" height=\"456\" srcset=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Theme-Functions-Functions-PHP.png 1024w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Theme-Functions-Functions-PHP-300x134.png 300w, https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/Theme-Functions-Functions-PHP-768x342.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4><span data-preserver-spaces=\"true\">\u00a0Redirect Login to a specific URL<\/span><\/h4>\n<p><span data-preserver-spaces=\"true\">You can redirect your users to a particular URL by using the following code.<\/span><\/p>\n<pre><span data-preserver-spaces=\"true\">[ht_message mstyle=\u201dinfo\u201d title=\u201d\u201d show_icon=\u201d\u201d id=\u201d\u201d class=\u201d\u201d style=\u201d\u201d ]\/**<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* Set the URL to redirect to on Login.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @param string $url The visited URL.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @return string The URL to redirect to on Login. Must be absolute.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*\/<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">function my_forcelogin_redirect( $url ) {<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">return home_url( \u2018\/mypage\/\u2019 );<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">}<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">add_filter( \u2018v_forcelogin_redirect\u2019, \u2018my_forcelogin_redirect\u2019 );[\/ht_message]<\/span><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0#Adding Exceptions for Certain Pages\/post<\/strong><\/p>\n<p><span data-preserver-spaces=\"true\">You can bypass force login on any condition. You can use WordPress conditional tags also.\u00a0<\/span><\/p>\n<h4><strong><span data-preserver-spaces=\"true\">Bypass a Force Login<\/span><\/strong><\/h4>\n<p><span data-preserver-spaces=\"true\">You can use the following code for a Bypass login.<\/span><\/p>\n<pre><span data-preserver-spaces=\"true\">[ht_message mstyle=\u201dinfo\u201d title=\u201d\u201d show_icon=\u201d\u201d id=\u201d\u201d class=\u201d\u201d style=\u201d\u201d ]\/**<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* Bypass Force Login to allow for exceptions.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @param bool $bypass Whether to disable Force Login. Default false.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @return bool<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*\/<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">function my_forcelogin_bypass( $bypass ) {<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">if ( is_single() ) {<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">$bypass = true;<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">}<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">return $bypass;<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">}<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">add_filter( \u2018v_forcelogin_bypass\u2019, \u2018my_forcelogin_bypass\u2019 );[\/ht_message]<\/span><\/pre>\n<h4><strong><span data-preserver-spaces=\"true\">URLs of Whitelist<\/span><\/strong><\/h4>\n<p><span data-preserver-spaces=\"true\">You can use the following code for the URLs of Whitelist.<\/span><\/p>\n<pre><span data-preserver-spaces=\"true\">[ht_message mstyle=\u201dinfo\u201d title=\u201d\u201d show_icon=\u201d\u201d id=\u201d\u201d class=\u201d\u201d style=\u201d\u201d ]\/**<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* Filter Force Login to allow exceptions for specific URLs.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @param array $whitelist An array of URLs. Must be absolute.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">* @return array<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">*\/<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">function my_forcelogin_whitelist( $whitelist ) {<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">$whitelist[] = home_url( \u2018\/mypage\/\u2019 );<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">$whitelist[] = home_url( \u2018\/2015\/03\/post-title\/\u2019 );<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">return $whitelist;<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">}<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">add_filter( \u2018v_forcelogin_whitelist\u2019, \u2018my_forcelogin_whitelist\u2019 );[\/ht_message]<\/span><\/pre>\n<h4><span data-preserver-spaces=\"true\">Hiding the &#8216;Back to Sitename&#8217; Link<\/span><\/h4>\n<p><span data-preserver-spaces=\"true\">If you want to hide the Back to Sitename link, you can use the following code. The Back to site name link is always present on the WordPress login page.\u00a0<\/span><\/p>\n<pre><span data-preserver-spaces=\"true\">[ht_message mstyle=\u201dinfo\u201d title=\u201d\u201d show_icon=\u201d\u201d id=\u201d\u201d class=\u201d\u201d style=\u201d\u201d ]\/\/ Hide the \u2018Back to {sitename}\u2019 link on the login screen.<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">function my_forcelogin_hide_backtoblog() {<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">echo \u2018&lt;style type=\u201dtext\/css\u201d&gt;#backtoblog{display:none;}&lt;\/style&gt;\u2019;<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">}<\/span>\r\n\r\n<span data-preserver-spaces=\"true\">add_action( \u2018login_enqueue_scripts\u2019, \u2018my_forcelogin_hide_backtoblog\u2019 );[\/ht_message]<\/span><\/pre>\n<p><strong>Wrapping up:<\/strong><\/p>\n<p><span data-preserver-spaces=\"true\">If you want to hide your WordPress website because you want to keep it private or allow for registered members, you can force Login before visitors access your content. <\/span><span data-preserver-spaces=\"true\">You can use an easy-to-use plugin or code options like bypass force login and whitelist URLs.<\/span><\/p>\n<p><span data-preserver-spaces=\"true\">We hope this helps understand how to force users to login to WordPress.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose you want to create a WordPress website but don&#8217;t want it to be available for everyone. Maybe you want to build a member-only platform where some members or subscribers of your site can log in to it, Or maybe your blog has unique content that you want to make available for registered\/paid users only. [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":433,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-408","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wp-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v19.3 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Force Users To Login in WordPress<\/title>\n<meta name=\"description\" content=\"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Force Users To Login in WordPress\" \/>\n<meta property=\"og:description\" content=\"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Hostkicker\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-28T12:18:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-19T09:07:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png\" \/>\n\t<meta property=\"og:image:width\" content=\"693\" \/>\n\t<meta property=\"og:image:height\" content=\"511\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Olivia Smith\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How To Force Users To Login in WordPress\" \/>\n<meta name=\"twitter:description\" content=\"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Olivia Smith\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/\"},\"author\":{\"name\":\"Olivia Smith\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#\\\/schema\\\/person\\\/f06306b595baa96c90a0491b941d7660\"},\"headline\":\"How To Force Users To Login in WordPress\",\"datePublished\":\"2021-12-28T12:18:30+00:00\",\"dateModified\":\"2022-05-19T09:07:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/\"},\"wordCount\":667,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/How-To-Force-Users-To-Login-in-WordPress.png\",\"articleSection\":[\"Wp tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/\",\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/\",\"name\":\"How To Force Users To Login in WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/How-To-Force-Users-To-Login-in-WordPress.png\",\"datePublished\":\"2021-12-28T12:18:30+00:00\",\"dateModified\":\"2022-05-19T09:07:13+00:00\",\"description\":\"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#primaryimage\",\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/How-To-Force-Users-To-Login-in-WordPress.png\",\"contentUrl\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/How-To-Force-Users-To-Login-in-WordPress.png\",\"width\":693,\"height\":511,\"caption\":\"How To Force Users To Login in WordPress\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/force-users-to-login-in-wordpress\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Force Users To Login in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/\",\"name\":\"Hostkicker\",\"description\":\"Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#organization\",\"name\":\"Hostkicker\",\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/hostkicker-logo-01.png\",\"contentUrl\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/hostkicker-logo-01.png\",\"width\":940,\"height\":218,\"caption\":\"Hostkicker\"},\"image\":{\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/#\\\/schema\\\/person\\\/f06306b595baa96c90a0491b941d7660\",\"name\":\"Olivia Smith\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g\",\"caption\":\"Olivia Smith\"},\"url\":\"https:\\\/\\\/hostkicker.com\\\/blog\\\/author\\\/olivia\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Force Users To Login in WordPress","description":"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"How To Force Users To Login in WordPress","og_description":"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.","og_url":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/","og_site_name":"Hostkicker","article_published_time":"2021-12-28T12:18:30+00:00","article_modified_time":"2022-05-19T09:07:13+00:00","og_image":[{"width":693,"height":511,"url":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","type":"image\/png"}],"author":"Olivia Smith","twitter_card":"summary_large_image","twitter_title":"How To Force Users To Login in WordPress","twitter_description":"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.","twitter_image":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","twitter_misc":{"Written by":"Olivia Smith","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#article","isPartOf":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/"},"author":{"name":"Olivia Smith","@id":"https:\/\/hostkicker.com\/blog\/#\/schema\/person\/f06306b595baa96c90a0491b941d7660"},"headline":"How To Force Users To Login in WordPress","datePublished":"2021-12-28T12:18:30+00:00","dateModified":"2022-05-19T09:07:13+00:00","mainEntityOfPage":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/"},"wordCount":667,"commentCount":0,"publisher":{"@id":"https:\/\/hostkicker.com\/blog\/#organization"},"image":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","articleSection":["Wp tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/","url":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/","name":"How To Force Users To Login in WordPress","isPartOf":{"@id":"https:\/\/hostkicker.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","datePublished":"2021-12-28T12:18:30+00:00","dateModified":"2022-05-19T09:07:13+00:00","description":"The article explains about how you can force users to login before reading the content in WordPress. Either by using a plugin or coding.","breadcrumb":{"@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#primaryimage","url":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","contentUrl":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","width":693,"height":511,"caption":"How To Force Users To Login in WordPress"},{"@type":"BreadcrumbList","@id":"https:\/\/hostkicker.com\/blog\/force-users-to-login-in-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hostkicker.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Force Users To Login in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/hostkicker.com\/blog\/#website","url":"https:\/\/hostkicker.com\/blog\/","name":"Hostkicker","description":"Blog","publisher":{"@id":"https:\/\/hostkicker.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hostkicker.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/hostkicker.com\/blog\/#organization","name":"Hostkicker","url":"https:\/\/hostkicker.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hostkicker.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/hostkicker-logo-01.png","contentUrl":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/hostkicker-logo-01.png","width":940,"height":218,"caption":"Hostkicker"},"image":{"@id":"https:\/\/hostkicker.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/hostkicker.com\/blog\/#\/schema\/person\/f06306b595baa96c90a0491b941d7660","name":"Olivia Smith","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/24a6b2466362238ad275f97a2f2fc49ce8d139c034114d6b9c52de1b12ebf1bd?s=96&d=mm&r=g","caption":"Olivia Smith"},"url":"https:\/\/hostkicker.com\/blog\/author\/olivia\/"}]}},"jetpack_featured_media_url":"https:\/\/hostkicker.com\/blog\/wp-content\/uploads\/2021\/12\/How-To-Force-Users-To-Login-in-WordPress.png","_links":{"self":[{"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":13,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":2033,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions\/2033"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/media\/433"}],"wp:attachment":[{"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostkicker.com\/blog\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}