File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
packages/gatsby-source-wordpress Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ module.exports = {
58
58
baseUrl: " live-gatbsyjswp.pantheonsite.io" ,
59
59
// The protocol. This can be http or https.
60
60
protocol: " https" ,
61
+ // The rest api route prefix that your WordPress site is using.
62
+ // Sometimes this is modified by WordPress plugins.
63
+ // If not set, it uses the default of "wp-json"
64
+ restApiRoutePrefix: " wp-json" ,
61
65
// Indicates whether the site is hosted on wordpress.com.
62
66
// If false, then the assumption is made that the site is self hosted.
63
67
// If true, then the plugin will source its content on wordpress.com using the JSON REST API V2.
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ async function fetch({
53
53
_concurrentRequests,
54
54
_includedRoutes,
55
55
_excludedRoutes,
56
+ _restApiRoutePrefix,
56
57
typePrefix,
57
58
refactoredEntityTypes,
58
59
} ) {
@@ -65,7 +66,7 @@ async function fetch({
65
66
url = `https://public-api.wordpress.com/wp/v2/sites/${ baseUrl } `
66
67
_accessToken = await getWPCOMAccessToken ( _auth )
67
68
} else {
68
- url = `${ _siteURL } /wp-json `
69
+ url = `${ _siteURL } /${ _restApiRoutePrefix } `
69
70
if ( shouldUseJwt ( _auth ) ) {
70
71
_accessToken = await getJWToken ( _auth , url )
71
72
}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ let _excludedRoutes
25
25
let _normalizer
26
26
let _normalizers
27
27
let _keepMediaSizes
28
+ let _restApiRoutePrefix
28
29
29
30
exports . sourceNodes = async (
30
31
{
@@ -53,6 +54,7 @@ exports.sourceNodes = async (
53
54
normalizer,
54
55
normalizers,
55
56
keepMediaSizes = false ,
57
+ restApiRoutePrefix = `wp-json` ,
56
58
}
57
59
) => {
58
60
const { createNode, touchNode } = actions
@@ -70,6 +72,7 @@ exports.sourceNodes = async (
70
72
_includedRoutes = includedRoutes
71
73
_excludedRoutes = excludedRoutes
72
74
_keepMediaSizes = keepMediaSizes
75
+ _restApiRoutePrefix = restApiRoutePrefix
73
76
_normalizer = normalizer
74
77
_normalizers = normalizers
75
78
@@ -87,6 +90,7 @@ exports.sourceNodes = async (
87
90
_includedRoutes,
88
91
_excludedRoutes,
89
92
_keepMediaSizes,
93
+ _restApiRoutePrefix,
90
94
typePrefix,
91
95
refactoredEntityTypes,
92
96
} )
@@ -240,6 +244,7 @@ exports.sourceNodes = async (
240
244
concurrentRequests,
241
245
excludedRoutes,
242
246
keepMediaSizes,
247
+ restApiRoutePrefix,
243
248
}
244
249
245
250
// apply custom normalizer
You can’t perform that action at this time.
0 commit comments