Answers.Body: <p>Just messed up with my code:</p>
  
  <pre><code>[insert_php]
  // Perform bootstrap
  civicrm_initialize();
  
  $result = civicrm_api3('Event', 'get', array(
    'sequential' =&gt; 1,
    'return' =&gt; "title,summary,custom_31"
  ));
  
  print_r($result);
  [/insert_php]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-18T18:18:38.423Z
Answers.LastActivityDate: 2015-08-18T18:18:38.423Z
Answers.UserDisplayName: Francis Poisson
Body: <p>CiviCRM 4.6.6 Wordpress 4.2.4</p>
  
  <p>The code in my wordpress page: </p>
  
  <pre><code>[insert_php]
  // Perform bootstrap
  civicrm_initialize();
  
  $result = civicrm_api3('Event', 'get', array(
    'sequential' =&gt; 1,
    'return' =&gt; "title,summary,custom_31",
    'event_type_id' =&gt; "",
  ));
  
  print_r($result);
  [/insert_php]
  </code></pre>
  
  <p>the ouput on my page:</p>
  
  <pre><code>Array
  (
  [is_error] =&gt; 0
  [version] =&gt; 3
  [count] =&gt; 0
  [values] =&gt; Array
  (
  )
  
  )
  </code></pre>
  
  <p>There should be data.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks.</p>
  
Tags: <civievent><api>
Title: Why am I getting no data when using PHP API on wordpress page?
ThreadText: # Why am I getting no data when using PHP API on wordpress page?
  
  (Asked by: username_0 on 2015-08-18)
  
  CiviCRM 4.6.6 Wordpress 4.2.4
  The code in my wordpress page: 
  [insert_php]
  // Perform bootstrap
  civicrm_initialize();
  
  $result = civicrm_api3('Event', 'get', array(
    'sequential' => 1,
    'return' => "title,summary,custom_31",
    'event_type_id' => "",
  ));
  
  print_r($result);
  [/insert_php]
  
  the ouput on my page:
  Array
  (
  [is_error] => 0
  [version] => 3
  [count] => 0
  [values] => Array
  (
  )
  
  )
  
  There should be data.
  What am I doing wrong?
  Thanks.
  
  **Tags:** civievent, api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-08-18. Score: 1
  
  Just messed up with my code:
  [insert_php]
  // Perform bootstrap
  civicrm_initialize();
  
  $result = civicrm_api3('Event', 'get', array(
    'sequential' => 1,
    'return' => "title,summary,custom_31"
  ));
  
  print_r($result);
  [/insert_php]
  
  
  ---
  
  