Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #618

Merged
merged 10 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eighty-cheetahs-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@headstartwp/core": patch
---

Adding support for basic auth
20 changes: 20 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"@headstartwp/core": "1.1.1",
"@10up/react-hooks": "1.2.3",
"@headstartwp/next": "1.1.3",
"@10up/next-redis-cache-provider": "0.1.5",
"@10up/headless-docs": "1.0.0",
"@10up/wp-multisite-i18n-nextjs": "0.2.0",
"@10up/wp-multisite-nextjs": "0.2.0",
"@10up/wp-nextjs": "0.2.0",
"@10up/wp-nextjs-ts": "0.2.1-next.2",
"@headstartwp/headstartwp": "1.0.9"
},
"changesets": [
"eighty-cheetahs-wonder",
"wild-pandas-tickle"
]
}
5 changes: 5 additions & 0 deletions .changeset/wild-pandas-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@headstartwp/core": patch
---

Fix: fetchHookData with usePosts and throwIfNotFound set to false will crash the application if no results are found
2 changes: 1 addition & 1 deletion docs/documentation/01-Getting Started/headless-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ After adding a custom taxonomy to the config, you will be able to filter posts b

```js
usePost({ postType: ['book'], genre: 'action' });
usePosts({ postType:'book', genre: 'action' perPage: 10 });
usePosts({ postType:'book', genre: 'action', perPage: 10 });
useTerms({ taxonomy: 'genre' });
```

Expand Down
19 changes: 19 additions & 0 deletions docs/documentation/06-WordPress Integration/basic-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /wordpress-integration/basic-auth
---

# Basic Auth

If WordPress is protected by Basic Auth (which is common during development) you can tell HeadstartWP the basic auth creds so that all
REST API requests include them. To do so, simply add the following env variables:

```
WP_BASIC_AUTH_USERNAME=username
WP_BASIC_AUTH_PASSWORD=password
```

:::caution
The above env variables will only be accessible server-side and therefore any client-side requests made directly to WordPress will fail. This happens because Next.js only includes env variables prefixed with `NEXT_PUBLIC_` in the browser bundle.

If you want your client-side requests to work, prefix the above variables with `NEXT_PUBLIC_`. But note that the basic auth creds will be leaked to the public.
:::caution
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading