Source plugin for pulling posts and media items from Wordpress via Graphql.
An example site for using this plugin hosted here: https://magloft.github.io/gatsby-source-wordpress-graphql/
npm install gatsby-source-wordpress-graphql
# OR
yarn add gatsby-source-wordpress-graphql
Configure Plugin Options:
{
resolve: 'gatsby-source-wordpress-graphql',
options: {
// Your Wordpress GQL Endpoint
host: 'https://www.domain.com/graphql',
// HTTP Authorization Header
authorization: 'Basic ...',
// Cache Adapter, either `gatsby` or `persist`
cacheAdapter: 'gatsby',
// Records to fetch per request
perPage: 100,
// Media Item Import batch size
batchSize: 10,
// Content transformation options via unihtml
transformContent: ({ clean }) => { clean() }
// Skip checking for new resources after initial sync
cacheOnly: false,
// List of resources to import
importResources: ['post', 'page', 'user', 'category', 'media']
}
}
- Build plugin using
yarn build
- Run
yarn link
inbuild/
folder - Run
yarn link gatsby-source-wordpress-graphql
inexample/
folder - Create
gatsby-config.js
inexample
folder (based onbuild
file) and fill inauthorization
details