How to show our posts and pages only to registered users?

Gauloran

Kıdemli Moderatör
7 Tem 2013
8,096
585
local
How to show our posts and pages only to registered users? /Wordpress



If you want to show posts and pages only to registered users, just add this code to the Functions.php file in the theme folder.

Kod:
$subRole = get_role( ’subscriber’ );
$subRole->add_cap( ’read_private_posts’ );
$subRole->add_cap( ’read_private_pages’ );
Or you can use Content Control – User Access Restriction Plugin.

Content Control is a lightweight and powerful plugin that allows you to take complete control of your website’s content by restricting access to pages/posts to logged-in users, specific user roles or to logged out users.

The plugin also enables you to restrict access to certain parts of a page/post using shortcodes e.g [content_control]Logged in content[/content_control]

Lastly, the plugin allows you to control the visibility of each sidebar/footer widget by selecting who can view each widget (everyone, logged out users, logged in users, specific user roles).

Full Feature List

Content Control allows you to do the following:

Restrict access to pages/posts to logged in/out users or specific user roles
Restrict access to media, tags, categories, format to logged in/out users or specific user roles
Display a custom message to users who do not have permission to view the content
Redirect users who do not have permission to view the content to the login page (redirects back to page/post after login), website homepage or custom URL
Display certain content on a page/post to logged-in users only
Display certain content on a page/post to specific user roles
Display certain content on a page/post to logged out users
Apply custom CSS classes to on-page content restriction shortcodes
Control the visibility of each sidebar/footer widget by selecting who can view each widget (everyone, logged out users, logged in users, specific user roles).
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.