If you want to check if a post has a password, and that the password has been entered, check both post_password_required()
and $post->post_password
:
$post = get_queried_object();
if ( ! post_password_required( $post ) && ! empty( $post->post_password ) ) {
// Post has a password, but has been entered.
}
Related Posts:
- Using WP page password protection as defacto login
- Apply the_title() filter in post & page title, but not in menu title
- Edit menu item title from edit page/post
- Disable most recent & view all (TABS) on nav-menu.php
- Using wp_list_pages() after calling query_posts()
- disable Tab post on nav-menus page (Admin)
- Making a new post visible on a specific page
- Go back to the exact post page number
- Parent menu item does not display posts when I add the sub-items
- I lost the link to my posts in my menu bar
- Page and Posts loading as index page? Not loading the content
- Call posts of particular category in a page
- Add custom class to existing menu items from custom meta
- How to make posts appear under pages
- Adding a post to a page
- Posts vs Pages and categories
- Including link to custom post type in ‘wp_list_pages’ function
- How to dynamically parse and transform post/page content before displaying it?
- How to make default “Privacy Policy Page” a normal page?
- Proper way of establishing custom landing pages in WordPress
- Add wp-link-pages to post
- 404 error on every post and page other than home
- Allow users to create their own page/s
- how to change the permalink to a specific location?
- “Current” class on a singular page menu item with custom post types?
- some posts being displayed as pages
- Using Post ID and Page ID in same function
- How to arrange different post categories in template
- Load Pages Menu in single.php
- One of my posts is displayed as page
- Display Post by menu order
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- How to mix pages and sub-categories in a url
- get next/previous post name
- Get part of a page url
- can’t post immediately
- How can i add new post on new page
- Get post title of faulty link on 404 error page
- Get current post’s child page?
- Make a custom URL and link to custom Template
- How to display a paginated list of posts from one category on a page? [duplicate]
- Displaying only posts from a certain category on my custom page template
- The next_posts_link() works only with original $wp_query
- Cant retrieve $_POST inside page, just header
- I need to create a page or post hierarchy
- Home page: using custom fields for posts and pages
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- How to Post to Specific Pages?
- how to style an individual page in a category [duplicate]
- associate posts to a page
- The loop: more posts than I want to fit on one page
- How do i put a dropdown list of ALL my post in the sidebar menu?
- Automatically delete default posts and pages on theme install?
- Redirecting posts in WordPress to a specific page
- Woocommerce – custom post type of checkout page
- The post order is different for logged-in and non-logged-in users? [closed]
- Posts and pages not getting published
- Limit amount of pages shown in pagination within wp_query
- How do I add an article to specific page?
- How to have more post in a page than in your home page
- how to show all type of author posts in author page (SOLVED)
- Custom post page has attributes of latest post [closed]
- custom post type single page template not working
- WordPress “Posts Page” isn’t showing template dropdown
- Wrap div-tag around posts in page
- Adding Count Post in Page
- Insert Shortcode exactly at the end of the content
- When and how will php code in a user made WordPress page be executed?
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to find the page of specific post?
- WordPress Page Column Problem [closed]
- The page that displays Posts on homepage
- How to have 2 posting pages on a blog
- Post data returning null [closed]
- Show full post only to loged-in users
- change page name on page list
- Cannot Create a new Post [closed]
- What function does the loop of displaying posts?
- How can I use wp_after_insert_post with $current_screen?
- Dynamic Menu Item
- wordpress category Description not allowed tag
- Header and Footer options in pages and posts
- Blog posts are not appearing as subs of Blog Page
- Automatically search and replace link in content (pages/posts)?
- How to remove category and other tags from posts page
- How to remove slug from CPT correctly?
- Edit Page button is gone
- I want the Title of page/post to show up topmost when reading the post/page
- Blog Posts Work in Preview, But Are Not Visible on the Live Page – READ MORE u003cspan aria-hidden=’true’u003e→u003c/spanu003e Error
- Images and menu links disapearing after saving
- How to display breadcrumb on category?
- When inserting media file in a post or page, show file name under the thumbnail
- Hide page title on dedicated posts page
- It tells me that I exceeded the maximum number of executions when trying to publish content
- Menu for all posts from multiple categories
- Parameter for pagination posts_pagination
- Is there a way to eliminate flyout menus when adding a post?
- WordPress menu disappears in category pages
- Menu item on a category
- Issue Copying Posts and Pages from One WordPress Site to Another