=== Unlisted Posts ===
Contributors: someguy9
Donate link: https://www.buymeacoffee.com/someguy
Tags: unlisted, hide posts, exclude, visibility, noindex
Requires at least: 5.7
Tested up to: 7.1
Requires PHP: 7.0
Stable tag: 2.0.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl.html

Add an "Unlisted" toggle to posts and pages. Unlisted content stays viewable by link but is hidden from lists, archives, feeds, search and search engines.

== Description ==

**Unlisted Posts** adds an "Unlisted" toggle to posts and pages. Switch it on and the post is left out of everywhere WordPress lists content, while anyone with the link can still open it. Handy for sharing a page with clients, publishing documentation you don't want in your blog feed, or keeping old content reachable without promoting it.

**What gets hidden**

* Blog home, category, tag, author and date archives
* Search results
* RSS and Atom feeds
* Core XML sitemaps
* Latest Posts, Query Loop and other blocks and widgets that list posts
* Previous / next post links
* The REST API lists used by the block editor and apps

Unlisted posts also send a `noindex` robots meta tag so search engines drop them, and the Posts and Pages admin lists show an "Unlisted" label next to each one.

**Where the toggle lives**

* Block editor: the post sidebar's Summary panel, next to Status and Visibility
* Classic editor: a checkbox in the Publish box

The plugin stores a single `_unlisted_post` post meta value and keeps a small cached list of unlisted IDs, so there is no extra query cost on the front end.

= Custom post types =

Posts and pages are supported by default. Add other post types with the `unlisted_posts_post_types` filter. A post type must support `custom-fields` for the block editor toggle to save.

`add_filter( 'unlisted_posts_post_types', function ( $types ) {
	$types[] = 'product';
	return $types;
} );`

== Installation ==

1. Upload the plugin to the wp-content/plugins directory, or install it from the Plugins screen.
2. Activate it from the Plugins screen.
3. Edit any post or page and switch on "Unlisted" in the sidebar's Summary panel (or the Publish box in the classic editor).

== Frequently Asked Questions ==

= Can people still see an unlisted post? =

Yes. Anyone with the link can open it and share it like any other URL. It is only left out of lists, feeds and search engines. If you need real access control, use WordPress's private or password-protected visibility instead.

= Will Google index unlisted posts? =

The page sends a `noindex` robots meta tag and is left out of the core XML sitemaps, so search engines that respect those signals will not index it. If an SEO plugin builds your sitemap, check that it honours `noindex` (most do) or exclude the post there as well.

= Does this work with the classic editor? =

Yes. The classic editor gets a checkbox in the Publish box, and the block editor gets a toggle in the Summary panel.

= I updated from 1.x. Do I need to do anything? =

No. Existing unlisted posts are migrated automatically the first time the admin loads after updating.

== Changelog ==

= 2.0.0 =
* Native block editor toggle in the sidebar's Summary panel replaces the old meta box. The classic editor gets a checkbox in the Publish box.
* Pages can now be unlisted too, and other post types can be added with the new `unlisted_posts_post_types` filter.
* Unlisted posts are now excluded from previous / next post links.
* "Unlisted" label in the Posts and Pages admin lists.
* The unlisted state is now stored as `_unlisted_post` post meta (exposed to the REST API), so it survives exports, imports and WP-CLI. Existing unlisted posts are migrated automatically.
* Deleting a post now removes it from the unlisted list.
* The `noindex` tag uses the `wp_robots` API instead of the deprecated `wp_no_robots()` function, and is only added on the unlisted post itself.
* No longer overwrites a `post__not_in` value set by other plugins or themes.
* Uninstalling the plugin now removes its data.
* Text domain corrected to `unlisted-posts` so translations from WordPress.org load.
* Tested up to WordPress 7.1. Requires WordPress 5.7 or newer.

= 1.1.0 =
* Tested up to WordPress 5.9.
* Compatibility with Gutenberg.
* Converted the unlisted post option to a meta box.

= 1.0.0 =
* Initial Release.
