All Collections
Developing with Shifter
Detecting generator's access on it's creating artifacts
Detecting generator's access on it's creating artifacts

Get Sfhiter's generator User-Agent

Tomohyco Tsunoda avatar
Written by Tomohyco Tsunoda
Updated over a week ago

Shifter Static will access your site with User-Agent of ShifterGenerator/{version} when it's creating artifact.

You can detect WordPress is running, or Shifter is generating artifact with using this User-Agent.

For example, you can set function $_SERVER['HTTP_USER_AGENT'] which contains above User-Agent, on PHP scripts.
โ€‹

if ( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'ShifterGenerator') !== false ) {

// some processes
// while Shifter is generating artifacts

} else {

// some processes
// while Shifter is not generating artifacts

}

Did this answer your question?