[wp-trac] [WordPress Trac] #25477: Notice: Trying to get property of non-object in .../wp-includes/post.php on line 2847

WordPress Trac noreply at wordpress.org
Thu Oct 3 14:00:41 UTC 2013


#25477: Notice:  Trying to get property of non-object in .../wp-includes/post.php
on line 2847
--------------------------+------------------------------
 Reporter:  jpswade       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.6.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by jpswade):

 The code below is based on the code provided on the wp_insert_post page
 here:
 http://codex.wordpress.org/Function_Reference/wp_insert_post

 To replicate this error, simply use the following:

 {{{
 <?php

 $post_type = 'custom-post-type';

 error_reporting(E_ALL);
 ini_set('display_errors', 'on');

 $p = array();
 $p['post_content'] = "Full content";
 $p['post_excerpt'] = "Short description";
 $p['post_name'] = 'test-name';
 $p['post_title'] = 'Test Title';
 $p['post_status'] = 'publish';
 $p['post_type'] = isset($post_type) ? $post_type : NULL;
 $p['tags_input'] = 'test, testing';
 $p['tax_input'] = array('taxonomy_name' => array('term', 'term2',
 'term3'));
 $post_id = wp_insert_post($p);
 echo $post_id;

 //eof
 }}}

 Errors:

 {{{
 Notice: Trying to get property of non-object in .../wp-includes/post.php
 on line 2847

 Notice: Trying to get property of non-object in .../wp-includes/post.php
 on line 2847

 Notice: Trying to get property of non-object in .../wp-includes/post-
 template.php on line 29
 }}}

 Are you able to replicate this?

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25477#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list