[wp-trac] [WordPress Trac] #42699: WP_Post $post object not properly returning values for meta keys

WordPress Trac noreply at wordpress.org
Sun Nov 26 02:11:36 UTC 2017


#42699: WP_Post $post object not properly returning values for meta keys
--------------------------------+------------------------------
 Reporter:  saiu                |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  4.9
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by saiu):

 I bypassed the transient and the problem still occurs. This is the
 original query, initiated by calling the function:

 {{{
 function cslr_listprojects() {
   return new WP_Query( array (
     'post_type' => 'project',
     'orderby' => "title",
     'order'   => 'ASC' )
   );
 }
 }}}

 {{{

 $projects = cslr_listprojects();
 ...
 while ($projects->have_posts()) {
         $projects->the_post();
 ...

 /// this line always works, even for loops that fail later
 if (isset($post->projectsiteid)) { get_template_part( 'components
 /projects-list-posts' ); }

 ...

 <a class="button" href="<?php echo $post->projectlink;?>">Go to
 Website</a>

 ...

 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42699#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list