Перайсці да змесціва
WordPress.org

Беларуская мова

  • Тэмы
  • Плагіны
  • Навіны
  • Падтрымка
  • Пра нас
  • Remembers
  • Blocks
  • Education
  • Дапаможнік
  • WP-CLI
  • Звязацца з намі
  • Спампаваць WordPress
Спампаваць WordPress
WordPress.org

Plugin Directory

Headless Login Guard

  • Адправіць плагін
  • Мае абраныя
  • Увайсці
  • Адправіць плагін
  • Мае абраныя
  • Увайсці

Headless Login Guard

Аўтар: Andrew Wilkinson
Спампаваць
  • Падрабязнасці
  • Водгукі
  • Ўсталёўка
  • Распрацоўка
Падтрымка

Апісанне

A lightweight plugin that forces login for backend access in a headless WordPress setup. Keeps your WordPress dashboard private while allowing your front end (e.g. Astro, Next.js) to pull content via GraphQL/REST.

What it does

  • Requires authentication for /wp-admin/ and other backend pages
  • Always allows the login page to avoid redirect loops
  • Leaves key endpoints open for headless use:
    • /wp-json/ (REST API)
    • /graphql (WPGraphQL)
    • /wp-admin/admin-ajax.php (AJAX)
    • /wp-cron.php (cron)
    • /robots.txt
    • WordPress core and common SEO sitemap XML paths
    • /wp-content/uploads/* (media)
    • /favicon.ico
    • /newrelic (New Relic monitoring)
  • Logged-in users visiting the backend root get redirected to the dashboard
  • Works with Bedrock layouts (handles root path vs /wp/)

Use case

  • WordPress is the content backend
  • Public site is built with Astro/Next.js/etc
  • Editors log in to WordPress. Visitors never see the backend
  • Front end builds and live pages can still query GraphQL/REST without authentication

Customization

Developers can customize allowed endpoints using the force_login_allowed_patterns filter:

add_filter('force_login_allowed_patterns', function($patterns) {
    $patterns[] = '#^/healthz$#';           // custom health check
    $patterns[] = '#^/status$#';            // uptime checks
    $patterns[] = '#^/wp-json/acf/v3/.*#';  // specific REST namespace
    return $patterns;
});

Ўсталёўка

  1. Upload the plugin files to the /wp-content/plugins/headless-login-guard directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress.
  3. The plugin will automatically start protecting your backend – no configuration needed!

Часта задаваныя пытанні

I’m locked out! How do I access my site?

Visit /wp-login.php directly to sign in. The plugin always allows access to the login page.

My front-end requests are failing. What should I do?

Verify the endpoint is on the allow list. Check the plugin description for the default allowed patterns, or use the force_login_allowed_patterns filter to add custom endpoints.

Does this work with Bedrock?

Yes! The plugin correctly handles both standard WordPress installs and Bedrock layouts where the site URL and home URL may differ.

Can I add custom endpoints?

Yes, use the force_login_allowed_patterns filter to add your own regex patterns for additional endpoints that should remain public.

Водгукі

Guards my headless WP

thewebist 31 ліпеня, 2026
Does what it says. Guards my headless WP setup.
Чытаць 1 водгук

Удзельнікі і распрацоўшчыкі

“Headless Login Guard” з’яўляецца праграмным забеспячэннем з адкрытым зыходным кодам. Наступныя людзі ўнеслі свой уклад у гэты плагін.

Удзельнікі
  • Andrew Wilkinson

Перакласці “Headless Login Guard” на вашу мову.

Зацікаўлены ў распрацоўцы?

Праглядзіце код, праверце SVN рэпазітарый, або падпішыцеся на журнал распрацоўкі па RSS.

Журнал змяненняў

1.1.0

  • Fixed: Allow WordPress core, Yoast-style, and nested sitemap XML paths
  • Fixed: Match allowlisted endpoints correctly on subdirectory, Bedrock, and multisite installations
  • Fixed: Preserve query strings without duplicating the site path in login redirect destinations
  • Improved: Parse request paths separately from query strings
  • Improved: Send no-cache headers before login redirects
  • Improved: Added redirect, sitemap, query-string, and subdirectory integration tests

1.0.1

  • Added: New Relic monitoring endpoint allowlist pattern (/newrelic) to support APM monitoring
  • Added: WordPress.org plugin directory compatibility
  • Added: Proper plugin structure with activation/deactivation hooks
  • Added: Filter hook for customizing allowed patterns
  • Improved: Code organization and documentation

1.0.0

  • Initial release
  • Restricts backend (/wp-admin/) to authenticated users
  • Allows GraphQL and REST API endpoints for headless front-ends
  • Basic whitelist of essential endpoints (cron, ajax, robots.txt, sitemaps, uploads)

Мета

  • Версія 1.1.0
  • Апошняе абнаўленне 4 тыдні таму
  • Актыўных установак Менш за 10
  • Версія WordPress 6.0 або вышэй
  • Правераны да версіі 7.0.4
  • Версія PHP 8.1 або вышэй
  • Мова
    English (US)
  • Тэгі
    GraphQLheadlessloginrest-apisecurity
  • Пашыраны прагляд

Ацэнкі

5 з 5 зорак.
  • 1 5-star review 5 зорак 1
  • 0 4-star reviews 4 зоркі 0
  • 0 3-star reviews 3 зоркі 0
  • 0 2-star reviews 2 зоркі 0
  • 0 1-star reviews 1 зорка 0

Ваш водгук

Паглядзець усе водгукі

Удзельнікі

  • Andrew Wilkinson

Падтрымка

Ёсць што сказаць? Патрэбна дапамога?

Перайсці да форуму падтрымкі

  • Пра нас
  • Навіны
  • Хостынг
  • Прыватнасць
  • Вітрына
  • Тэмы
  • Плагіны
  • Патэрны
  • Навучанне
  • Падтрымка
  • Распрацоўнікі
  • WordPress.tv ↗
  • Далучыцца
  • Падзеі
  • Падтрымаць ↗
  • Сувеніры ↗
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org
WordPress.org

Беларуская мова

  • Наведайце нас у X (былы Twitter)
  • Наведайце нас у Bluesky
  • Наведайце нас у Mastodon
  • Наведайце нас у Threads
  • Наведайце нашу старонку Facebook
  • Наведайце нас у Instagram
  • Наведайце нас у LinkedIn
  • Наведайце нас у TikTok
  • Наведайце наш YouTube канал
  • Наведайце нас у Tumblr
Код – гэта паэзія.
The WordPress® trademark is the intellectual property of the WordPress Foundation.