Gatsby Wordpress Admin

What does it do?

Adds WP cookie authentication to your WP Gatsby site to keep you authenticated in WP and your frontend at the same time. Automatically creates a /login and /dashboard page to manage your content.

You can also import the custom useAuth hook anywhere in your application. It will return your user.

Getting Started

  1. yarn add gatsby-theme-headless-wordpress-admin

Required WP plugins


Example usage

import { useAuth } from "gatsby-theme-headless-wordpress-admin";

const { auth } = useAuth();


Example usage

import { useLogin } from "gatsby-theme-headless-wordpress-admin";

const [sendUserLogin, { data, error, loading, called }] = useLogin({
  onCompleted: (data) => {
    console.log({ data });
  onError: (err) => {
    console.log({ err });

  onClick={() =>
      variables: { username: "your_username", password: "your_password" },