A hook that runs only when the theme is previewed

Is there a function or a hook that runs only when a theme is previewed?

I’m referring to the preview feature that you get on the Appearance->Themes page.

The reason for this is that I want to change specific design aspects on the theme but only when the user is previewing it.

2 Answers
2

I think you could use the ?preview=true in the url something like :

if ($GET['preview']) {
// your hook or function
}

Leave a Comment