You can actually hook the built-in page/post password feature and set it up to check for url params that match page/post password, and then change the value of $required
to false
.
add_filter( 'post_password_required', 'my_allow_url_param', 10, 2 );
function my_allow_url_param( $required, $post ) {
if ( empty( $post->post_password ) ) {
$required = false;
return $required;
}
if ( $_GET['code'] == $post->post_password ) {
$required = false;
}
return $required;
}
If you had a page with the slug of /sample-page/
and in the admin set a password of Cf5aTgZqBz5h6g1y858eQmpTWizzHzZN
in the visibility setting on edit screen of that page, you could access it without logging in or typing a password with the following url:
http://sitename.com/sample-page/?code=Cf5aTgZqBz5h6g1y858eQmpTWizzHzZN
Related Posts:
- Replace existing pages with new pages, keep menu links
- How can I make it so the Add New Post page has Visibility set to Private by default?
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Delete Post With No Traffic?
- Create page when plugin is activated
- Automatically Creating Posts for Popular Forum Topics or Products [closed]
- jQuery plugin only in one page/post
- How to create a Page alias in WordPress
- WP get_permalink Return Wrong URL
- How to extract images of post and pages excluding header and logo image in wordpress?
- Is there a plugin to display certain posts on certain pages? [closed]
- plugin for wp_list_categories with posts
- [Plugin: Posts 2 Posts] How does it work?
- Distributing and packaging plugins
- Use plugin or custom post type for game score functionality
- Copyright messages for a particular set of pages
- Show a special message for private page?
- Output HTML only on individual post view
- Run plugins only on certain pages
- Add category selection to custom post type (plugin)
- Redirect to another page using contact form 7? [closed]
- Would Gutenberg be considered a PlugIn?
- Making my plugin create a page?
- Moving FB comments at the end of page
- Change website directory safely to add a static page on startup
- How can i summerize posts or news automatically in word press site?
- Delete data from custom table when deleting a post
- What is the best way to make a custom page from a plugin?
- Link Posts to External URL
- Oops! That page can’t be found
- Copy/paste local images not working in WordPress
- Elementor: How to design Dropdown Select Box Navigation page like Chegg
- Give custom page template a custom post ID
- Adding LOAD MORE on a page
- Randomize post (and page) IDs on generation
- Powerpress upload a podcast without creating a post for it
- Failed to load resource: the server responded with a status of 500 () post.php
- Get content and send to 3rd party
- Best approach to serve static content within a regular page
- Hidden Some Setting on Post or Page [duplicate]
- Better code/text editing for posts and pages?
- Restrict my pages from public
- Style WordPress Custom Post Type Single Page
- Posts are deleted everyday at night
- Issues with Post 2 Post Plugin
- WordPress ultra slow if I click on posts?
- Get page type to display content
- How to make only selected posts appear on a selected wordpress page
- Static page with formatted post list
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- Looking for membership style plugin with edit option [closed]
- How to show custom post type in all post section?
- Disable plugin only for one post
- Free paypal cart solution [closed]
- Add filter on html tags,attributes on specific function in wordpress
- Which plugin can do horizontal scrolling of RSS feeds in WordPress [closed]
- When I try to de-activate any plugin it gives error “Warning: call_user_func_array() [function.call-user-func-array]”
- Text change in Advanced Customs Fields [closed]
- Simulating a wp page – wp page load sequence
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- posts from multiple post types in one slider
- Custom API plugin to execute 3rd party API to retrieve data
- How to display the featured post on the category page?
- Loop in elementor custom widget not working
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- I am trying to make a field show and save from quickedit screen
- Overriding an Array in a Plugin’s Class/Function from functions.php
- Historical customisations won’t go away [closed]
- WordPress – source link plugin – how to modify it?
- Flickering sidebar when scrolling page [closed]
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Where Should i write the code for wordpress ajax voting?
- Customizing a blog page layout
- Minimize and Uglify WordPress Plugin Files
- .php file for woocommerce edit category? [closed]
- Advanced WordPress plugin activation detection
- Customize Menu | Styling LESS/SCSS code formats
- download button for audio file in post [closed]
- check uncategorized category by default
- Print posts category or tag as a formatted journal
- How to create wordpress page that lets users create their own quiz? [closed]
- shortcode – multiple instances of same parameter name in one shortcode instance
- how to execute some code after a post is published in WordPress [duplicate]
- How to create a plugin that includes all the other plugins?
- Hide a certain category name from Related Posts
- How to create plugin in wordpress [closed]
- Post status doesn’t update to ‘future’ every time?
- how to add custom info on author page? plugin, child theme?
- Why is it important to check for isset and is_array before checking in_array in this example?
- Huge number of 404 pages getting spawned
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Function added to hook “new_to_publish” not executing – custom plugin
- Change Header (Logo) Based on Login
- how to change wp-admin url using function file
- Calling a save function from a “submit” button
- Creating an admin meta box to save post as pending
- trigger email when post is published by someone a user follows
- Grab ID from post from plugin and use it to create an object
- Is there a way to easily manage Project options (custom-fields)