Answers.Body: <p>The error message <a href="https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/System/Base.php#L260" rel="nofollow noreferrer">comes from here</a> and indicates that <a href="https://github.com/civicrm/civicrm-core/blob/master/bin/cron.php" rel="nofollow noreferrer"><code>cron.php</code></a> is not bootstrapping the WordPress CMS, so WordPress functions aren't available.</p>
  
  <p>WordPress <code>is_admin()</code> is defined in <a href="https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/load.php#L657" rel="nofollow noreferrer"><code>wp-includes/load.php</code></a>. If WordPress was initialised, that function would be present.</p>
  
  <p>If you are able to <em>configure your cron to execute via commandline</em> (eg <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-wp-climethod" rel="nofollow noreferrer">wp-cli method</a> or <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod" rel="nofollow noreferrer">PHP CLI method</a>) instead of by request to cron.php, that might give you a workaround for whatever issue is affecting this setup. (Edit: Oh, you tried that? Sorry!)</p>
  
  <p>There was a previous report (from 2012) of the same behaviour: <a href="https://issues.civicrm.org/jira/browse/CRM-9727" rel="nofollow noreferrer">CRM-9727: cron.php will not run in Wordpress, is_admin() call to undefined function</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-18T23:25:49.330Z
Answers.Text: thanks: I had a look at the issue but to be honest nothing actually seemed to happen to resolve it - and it was a long time ago now.  Is it a realistic possibility that its a Wordpress plugin?  Ive not changed anything - except this update and cron's been working fine for years
Answers.UserDisplayName: Robinnz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-19T00:03:28.147Z
Answers.Text: If a WordPress plugin was loaded, then I'd expect `is_admin()` to be available. So my read of that is that it shouldn't be a WordPress plugin causing this.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-17T05:19:46.863Z
Answers.LastActivityDate: 2016-12-17T05:19:46.863Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>well its fixed ..sort of</p>
  
  <p>I was advised to use WP-CLI and that got Cron running.. but still dont know why the URL method was failing</p>
  
  <p>dodgy Wordpress plug in?  who knows...</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-02T00:00:19.753Z
Answers.LastActivityDate: 2017-01-02T00:00:19.753Z
Answers.UserDisplayName: Robinnz
Body: <p>I upgraded to 4.7.14 and now I get the following error when running /wp-content/plugins/civicrm/civicrm/bin/cron.php.  I'm running Wordpress 4.7.</p>
  
  <blockquote>
    <p>Fatal error:  Uncaught exception 'Exception' with message 'Function &quot;is_admin()&quot; is missing, even though WordPress is the user framework.' in /home/mysite/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php:261
    Stack trace: etc</p>
  </blockquote>
  
  <p>This is similar to the post <a href="https://civicrm.stackexchange.com/questions/9353/cron-error-after-upgrade-to-4-7-1">Cron error after upgrade to 4.7.1</a>.</p>
  
  <p>cron has been running fine for years previously - on the same host</p>
  
  <p>I'm trying to run:</p>
  
  <pre><code>GET 'http://mysite.com.au/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=admin&amp;pass=somepassword&amp;key=sitekey'
  </code></pre>
  
  <p>I can run the jobs manually from the scheduled jobs screen and they complete</p>
  
  <p>I've tried:</p>
  
  <ol>
  <li>cli and URL versions</li>
  <li>changing permissions for cron.php and cli.php</li>
  <li>confirmed no special characters in password or site key</li>
  </ol>
  
  <p>That's about the extent of my capabilities sadly.. Any suggestions please?</p>
  
Tags: <wordpress><cron>
Title: Cron error after upgrading to 4.7.14 - Function "is_admin()" is missing, even though WordPress is the user framework
ThreadText: # Cron error after upgrading to 4.7.14 - Function "is_admin()" is missing, even though WordPress is the user framework
  
  (Asked by: username_0 on 2016-12-17)
  
  I upgraded to 4.7.14 and now I get the following error when running /wp-content/plugins/civicrm/civicrm/bin/cron.php. I'm running Wordpress 4.7.
  
  > Fatal error: Uncaught exception 'Exception' with message 'Function "is\_admin()" is missing, even though WordPress is the user framework.' in /home/mysite/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php:261
  > Stack trace: etc
  
  This is similar to the post [Cron error after upgrade to 4.7.1](https://civicrm.stackexchange.com/questions/9353/cron-error-after-upgrade-to-4-7-1).
  
  cron has been running fine for years previously - on the same host
  
  I'm trying to run:
  
  ```
  GET 'http://mysite.com.au/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=admin&pass=somepassword&key=sitekey'
  
  ```
  
  I can run the jobs manually from the scheduled jobs screen and they complete
  
  I've tried:
  
  1. cli and URL versions
  2. changing permissions for cron.php and cli.php
  3. confirmed no special characters in password or site key
  
  That's about the extent of my capabilities sadly.. Any suggestions please?
  
  **Tags:** wordpress, cron
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-12-17. Score: 3
  
  The error message [comes from here](https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/System/Base.php#L260) and indicates that [`cron.php`](https://github.com/civicrm/civicrm-core/blob/master/bin/cron.php) is not bootstrapping the WordPress CMS, so WordPress functions aren't available.
  
  WordPress `is_admin()` is defined in [`wp-includes/load.php`](https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/load.php#L657). If WordPress was initialised, that function would be present.
  
  If you are able to *configure your cron to execute via commandline* (eg [wp-cli method](https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-wp-climethod) or [PHP CLI method](https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod)) instead of by request to cron.php, that might give you a workaround for whatever issue is affecting this setup. (Edit: Oh, you tried that? Sorry!)
  
  There was a previous report (from 2012) of the same behaviour: [CRM-9727: cron.php will not run in Wordpress, is\_admin() call to undefined function](https://issues.civicrm.org/jira/browse/CRM-9727).
  
  > **Comments:**
  > **username_0**: thanks: I had a look at the issue but to be honest nothing actually seemed to happen to resolve it - and it was a long time ago now.  Is it a realistic possibility that its a Wordpress plugin?  Ive not changed anything - except this update and cron's been working fine for years  
  > **username_1**: If a WordPress plugin was loaded, then I'd expect `is_admin()` to be available. So my read of that is that it shouldn't be a WordPress plugin causing this.  
  
  ---
  
  ### Answer by username_0 on 2017-01-02. Score: 1
  
  well its fixed ..sort of
  
  I was advised to use WP-CLI and that got Cron running.. but still dont know why the URL method was failing
  
  dodgy Wordpress plug in? who knows...
  
  
  ---
  
  