Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get categories only assigned to post Wordpress

		<?php
		$categories = get_the_category();
		//echo '<pre style="text-align: left;">'.print_r($categories, true).'</pre>';
		foreach( $categories as $category) {
			$name = $category->name;
			$category_link = get_category_link( $category->term_id );

			?>

			<a href="<?php echo $category_link; ?>"><?php echo $name; ?></a>
		

		<?php } ?>
 
PREVIOUS NEXT
Tagged: #categories #assigned #post #Wordpress
ADD COMMENT
Topic
Name
7+2 =