title: Wordpress wp_schedule_event - not returning the next schedule
body: <p>I am having a hard time figuring out this issue. So basically, I wrote a plugin.. the file structure is as below </p>
  
  <pre><code>-myplugin.php (init and includes myplugin-common.php )
  -myplugin-admin.php (plugin menu item index and includes myplugin-part1.php and part2)
  -myplugin-common.php
  -myplugin-part1.php
  -myplugin-part2.php
  </code></pre>
  
  <p>i have a function that activates the cron if it is not already enabled .. example below (this is inside the myplugin.php)</p>
  
  <pre><code>function myplugin_cron_activate() {
  
      if ( get_option( SCHEDULE_ENABLED ) !== false ) {
          if ( get_option(SCHEDULE_ENABLED) == 'true') {
              if (!wp_next_scheduled('wpo_cron_event2')) {
  
                  $schedule_type = get_option(SCHEDULE_TYPE, 'weekly');
  
                  wp_schedule_event(time(), $schedule_type, 'my_cron_event2');
                  add_action('my_cron_event2', 'my_cron_action');
  
          }
          }
      }
  </code></pre>
  
  <p>now *my_cron_action* is inside a common file <em>myplugin-common.php</em> . Which is fine and it works anyway.. </p>
  
  <p>The problem is, <em>myplugin-part2.php</em> is a settings page to enable or disable the scheduler. When I enable it .. calls the *myplugin_cron_activate()* function. But <em>it does not activate the cron function in wordpress</em>. But when I go to the plugin main link in admin - it gets activated. </p>
  
  <p>Please note both <em>myplugin-part1.php, myplugin-part2.php</em> are included from inside the <em>myplugin-admin.php</em>. <em>myplugin-admin.php</em> holds 2 tabs and loads these 2 part of files accordingly. </p>
  
  <p>What I still can't figure out why the scheduler is not getting activated when i submit the settings page - yes i am calling the function there on $POST. But it gets activated when I click on the main link for the admin page.. (because of this I can't show the next schedule time either)</p>