[wp-hackers] Auto Add Page on Theme Select
peter.westwood at ftwr.co.uk
Tue Jun 9 18:23:48 GMT 2009
On 9 Jun 2009, at 19:11, Steve Bruner [SlipFire] wrote:
> Hi All,
> I'm creating a theme and would like a Page to be auto created when
> the theme
> is selected. Would obviously check to make sure the page doesn't
> pre-exist. Tried using the switch_theme hook but it seems that it
> execute in functions.php, only a plugin.
The switch_theme action will run when the previous theme is still
effectively active as during the page load the switch happens the old
themes functions.php is still included.
You best bet is to do something on the init action for now.
But it would be good to open a ticket in trac requesting a way for
this to be achieved.
I think we need an activation hook for the theme which runs on the
first page load that a theme is active for in the admin
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-hackers