[wp-trac] [WordPress Trac] #25005: Notice using get_sample_permalink()

WordPress Trac noreply at wordpress.org
Fri Aug 9 23:41:27 UTC 2013


#25005: Notice using get_sample_permalink()
--------------------------+-----------------------------
 Reporter:  juliobox      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  minor         |   Keywords:
--------------------------+-----------------------------
 Hello
 This is about a Notice in get_sample_permalink(), here the core:

 {{{
 function get_sample_permalink($id, $title = null, $name = null) {
         $post = get_post($id);
         if ( !$post->ID )
                 return array('', '');
 ...
 }}}

 So if the $id is not correct, the ''$post->ID'' will throw a '''Notice:
 Trying to get property of non-object in file.php on line n'''
 I think we can use a simple "'''!$post'''" or "'''is_a( $post, 'WP_Post' )
 )'''" here.
 Thanks for reading

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25005>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list