I think the answer is “it depends” — on how flexible and/or “slick” you want the solution to be. The quickest/easiest thing to do would be to create a custom post type (there are tried/true plugins out there that can help establish this) — and then in your theme functions.php (or in a very simple plugin), put in logic that redirects non-logged in users to a page of your choice, if the current post is of that type:
function guest_restrict () {
if ( !is_user_logged_in() && "restricted_post" == get_post_type( get_the_ID() ) )
wp_redirect( 'http://www.foosite.com/some/page' );
}
add_action('template_redirect','guest_restrict');
A “full blown” solution would be to bolt in a membership system (plugin) but that is a much bigger deal.
Related Posts:
- esc_attr() right way and use
- Enforcing password complexity
- Does My Child-Theme Functions.php Need if{die} Security In It? [duplicate]
- How Attackers write script into my php files?
- Remove admin bar for subscribers
- Renaming wp-content folder dynamically
- How do I create a WP user outside of WordPress and auto login?
- Security – Ajax and Nonce use [closed]
- Fix 403 error on WordPress multisite network using subdomains
- Can I write ‘RewriteCond’ using ‘functions.php’?
- Is it unsafe to put php in the /wp-content/uploads directory?
- Sanitize get_query_var() url parameters
- How to create Sub Sub domain Multi User blogs?
- woocommerce and is_user_logged_in() if not redirect to homepage
- When must I use and verify nonce?
- Hiding WordPress Plugin Source Code
- Is this code malidcous
- Admin username and password
- Evaluations of two wordpress security plans against php code injection attack
- WordPress custom login form using Ajax
- How to use my style.css file outside of wordpress subdomain?
- Detect session/cookie variable in wordpress to prevent access to documents
- Is there any risk setting WordPress file permissions and FS method to ‘direct’ on localhost?
- SQL Injection blocked by firewall
- How to prevent XSS alter custom global javascript object & methods in WordPress
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Cannot execute php files in wp-content
- How do I get around “Sorry, this file type is not permitted for security reasons”?
- Security: blocking direct access of php files
- Correct and safe way to include php content in my page
- Password minimum length in personal subscription [closed]
- How to add API security keys into JS of wordpress securely
- Is it best to avoid using $wpdb for security issues?
- Hardening uploads folder in IIS breaks images
- Troll the hackers by redirecting them
- Different Subdomain changes page content
- Security updates to 3.3.2
- how to prevent wordpress admin from logging in via woocommerce my-account page
- malware undetectable by multiple scans
- Decoded malware code [closed]
- How to allow download url redirection only if user logged in WordPress site?
- Automatically generator a WordPress installation on my subdomain
- Updating From Mobile App – Exposing Site to Hacking
- security concerns if using html data-* attribute for l10n?
- How to correctly escape an echo
- How to make Subdomain work for product_tag?
- Reject all malicious URL requests functions.php
- How to serve WordPress folder over subdomain?
- portfolio site – about this site section – is it safe to post some code
- echo cutom css code to WordPress page template file ? is this safe?
- How to secure my php forms
- $.ajax results in 403 forbidden
- Get WordPress username to customize url
- Dynamic Banner Text based on Subdomain
- Site infected by link
- Access WP files on “server 1”, from “server 2” – using wp-load on an external website
- Deny php execution in /wp-includes – using .htaccess in /wp-includes VS root folder
- Retrieve $_POST data to send to javascript without using localize script
- Previewing/Updating some Pages causes “The requested URL was rejected” Error
- How to quickly/easily make an analysis (reverse engineering) of WordPress?
- Masking external links with internal link for member-only
- what to do after instlling cyberpanel on VPS
- Duplicated WP Multisite for testing environment is redirecting to production site
- Access wordpress blog on subdirectory /blog that is running on subdomain
- Get the URL of the page from which an ajax request has been launched within ajax callback
- Edit the_category (); for a hierarchical display
- Wrapping a Sidebar within
- JSON REST API WordPress only showing first 10 categories
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- Category title output before opening title tag
- unable to use ‘new WP_Query’ in AJAX call
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- User register hook is not working in woocomerce register form
- Show meta box only for default page template
- Illegal string offset in PHP function
- echo something inside a shortcode
- Hide a div when tags doesnt exist [duplicate]
- admin-ajax Firing Error 400 When Logged In
- WordPress template page name displayed on screen
- Need to put a script above tag in header.php – WP 5.7.1
- Display related posts without a plugin
- How to use a custom hook
- Search WordPress using static html page
- How to check if the current page is at a specified path in the URL?
- How to use html inside a functions.php code?
- Multiple meta_key in one global $wpdb;
- Nested “do” and “add” Actions is possible?
- Can’t access site after making changes to the functions.php [closed]
- Hide HTML element (by class or ID) with PHP
- Deprecated: Function create_function() is deprecated [closed]
- Featured or last post with a different WordPress style without plugin
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- displaying content that includes shortcodes within an echo
- JS value to PHP variable to change div background color with PHP If else statement
- wp_force_remove_style’ not found
- Update a buggy installation
- Error – ‘create_function is deprecated’ [closed]
- Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?
- How to get post permalink url without a href
- How to fix “Object of class WP_Term could not be converted to string”?