WP_Query display categories assigned to post
-
Ive looked at several lines of code for hours and I cant seem to find out why when I do ` $port_args = array( ‘post_type’ => ‘foobar’, ‘posts_per_page’ => -1 );
$the_query = new WP_Query( $port_args ); ?>and usethe_category()it returns none of the tags assigned to the post. If I do aprint_r()onget_the_terms()I can see the array of assigned categories but I cant figure out how to echo them as plain text. So my question is how can you echo out the categories that are assigned to a post as text (no links) when using WP_Query? It works if I doif (have_posts()):while(have_posts()):the_post;withthe_category()`
The topic ‘WP_Query display categories assigned to post’ is closed to new replies.