Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a problem to get the term of custom posts list. I have 2 taxonomies on my custom post type. one of them is "visa_processing". and I am trying to create a list (table, tr, td) "Name1, Name2, passport num, processing."

"processing" is a term and each different.

I need to get "processing" term on list for each posts.

ex) John, Smith, K009923, waiting Price, Mark, K009923, failed Jordan, MC, K009923, issued

"applied, waiting, failed, issued" <--- these are terms of the taxonomy "visa_processing".

But terms are not showing or printed "Array". how can I fix it?

 $args = array(
'post_type'   => $post_type,
'numberposts' => $limit,
'post_status' => $status,
);
$posts = get_posts( $args );
if( count($posts) ):
$return .= '<table>';
foreach( $posts as $post ): setup_postdata( $post );

/** get meta values and replace **/
$getPassport = get_post_meta( get_the_ID(), '_Passport', true );
$getPassport_replaced = substr_replace($getPassport, "*", 3).'*****';

$getName1 = get_post_meta( get_the_ID(), '_Name1', true );
$getName2 = get_post_meta( get_the_ID(), '_Name2', true );
$getName2_replaced = substr_replace($getName2, "*", 3).'***';
//$getNames = get_the_title();  // 전체 이름 : 사용안함

//$processing = get_the_terms( get_the_ID(), 'visa_processing', array("orderby"=>"term_order"));
//$processing = wp_get_post_terms( get_the_ID(), 'visa_processing');
//$processing = wp_get_object_terms( get_the_ID(), 'visa_processing' );
//echo get_the_ID();

//$terms = get_the_terms();   print_r($terms);


  $return .= '<tr><td>' . $getName1 .'&nbsp;'. $getName2_replaced .'</td>  <td>'.$getPassport_replaced.'</td><td>'.$processing.'</td></tr>';

 endforeach; wp_reset_postdata();
   $return .= '</table></div>'; //#recent_visas
 else :
   $return .= '<p>No posts found.</p>';
 endif;

return $return;

share|improve this question
add comment

1 Answer

or printed "Array"

That is your clue. Array indicates something is being returned, you just need to make use of it.

Try var_dump($processing) and see what the array contains. In my plugins I have a functioned called example_var_dump(); and it is setup to use

 before the var_dump() line and 
after it. This displays arrays in a readable fashion.

Plus I have a global variable for debugging mode. If that is set to false, my example_var_dump() function does nothing. This is to avoid dumping information in a released version after forgetting to removing var_dump() in complex scripts. Just a tip.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["        <li><a href=\"http://area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"http://careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.3.15.1463\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    WordPress is a trademark of the WordPress Foundation, registered in the US and other countries. This site is not affiliated with the WordPress Foundation in any way.\r\n         "], "copyright__copyright__copyright": ["dable fashion.\n\nPlus I have a global variable for debugging mode. If that is set to false, my example_var_dump() function does nothing. This is to avoid dumping information in a released version after forgetting to removing var_dump() in complex scripts. Just a tip.\n\nshare|improve this answer\nadd comment\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}