I'd like to use the excellent Zoninator plugin with my theme, making it a required plugin using the TGM Plugin Activation Class. On activation of the plugin I want to create one or more zones programmatically. Can anyone tell me how to

  • Set a listener in my theme which performs a function when a particular plugin is activated
  • Create a specific Zoninator zone in that function, if it doesn't already exist?

For the first part I've tried this in my functions.php:

register_activation_hook( plugins_url('zoninator/zoninator.php', __FILE__), 'myplugin_activate' );

function myplugin_activate() {

But nothing happens when I activate Zoninator.

For the second part I've tried calling z_get_zones() to see what Zoninator zones already exist. But I get warnings like "Attempt to assign property of non-object in [..]\wordpress\wp-content\plugins\zoninator\zoninator.php on line 1129", and a WP error object that reports "Invalid taxonomy".

Thanks guys!

1 Answer 1


As advised by the Zoninator developer Mohammad Jangda, you can solve the second part of this problem like this:

    if (z_get_zone(‘home’) == ”) {
        global $zoninator;
        $zoninator->insert_zone( ‘home’, ‘Home’, array(‘description’ => ‘This is the Home Zone programmatically inserted’));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.