Shifter now supports appending URLs on your

How to apply

Insert following filter to functions.php on your theme.

Code

add_filter( 'ShifterURLS::AppendURLtoAll', 'my_append_urls' );

Samples

Sample Code A

Adding /wp-json/wp/v2/posts to the target URLs of the generator

function my_append_urls( $urls ) {
$urls[] = home_url('/wp-json/wp/v2/posts');
return $urls;
}
add_action( 'init', function(){
add_filter( 'ShifterURLS::AppendURLtoAll', 'my_append_urls' );
} );

Results A

/wp-json/wp/v2/posts/ ịs added to the target URL as "link_type": "from_filter_hook" and "path": "/wp-json/wp/v2/posts/".

$ curl -s https://127.0.0.1:8443/?urls | jq .

{
"datetime": "2020-07-07 02:41:39 UTC",
"page": null,
"start": 0,
"end": 100,
"limit": 100,
"items": [
{
"link_type": "home",
"post_type": "",
"link": "https://127.0.0.1:8443/",
"path": "/"
},

[... cropped ...]

{
"link_type": "from_filter_hook",
"post_type": "",
"link": "https://127.0.0.1:8443/wp-json/wp/v2/posts/",
"path": "/wp-json/wp/v2/posts/"
}
],
"request_type": "TOP",
"request_path": "/",
"count": 20,
"finished": true
}

Sample Code B

Appending list of the stats of US as /states/($slag) to the target URL.

function my_append_urls( $urls ) {
$states = [
'Alabama',
'Arizona',

[...cropped....]

'Wisconsin',
'Wyoming',
];
foreach ( $states as $slag ) {
$urls[] = home_url("/states/{$slag}/");
}
return $urls;
}
add_action( 'init', function(){
add_filter( 'ShifterURLS::AppendURLtoAll', 'my_append_urls' );
} );

Sample Result B

$ curl -s https://127.0.0.1:8443/wp-json/shifter/v1/urls?page=1 | jq .
{
"datetime": "2020-09-04 06:01:58 UTC",
"page": 1,
"start": 100,
"end": 200,
"limit": 100,
"items": [
{
"link_type": "term_feed",
"post_type": "column",
"link": "https://127.0.0.1:8443/column/feed/",
"path": "/column/feed/"
},
:
{
"link_type": "from_filter_hook",
"post_type": "",
"link": "https://127.0.0.1:8443/states/hokkaido/",
"path": "/states/Alabama/"
},
{
"link_type": "from_filter_hook",
"post_type": "",
"link": "https://127.0.0.1:8443/states/tohoku/",
"path": "/states/Alizona/"
},

[..... cropped .......]

{
"link_type": "from_filter_hook",
"post_type": "",
"link": "https://127.0.0.1:8443/states/kyushu/",
"path": "/states/Wisconsin/"
},
{
"link_type": "from_filter_hook",
"post_type": "",
"link": "https://127.0.0.1:8443/states/okinawa/",
"path": "/states/Wyoming/"
}
],
"request_type": "TOP",
"request_path": "/",
"count": 91,
"finished": true
}

Did this answer your question?