Category Description P-tag removed WordPress

  We know the columns page calling section describes the direct use <php echo category_description ();??> Ok, but using the above code calls Wordpress classification description will automatically appear P tag, such as <p> Here is a Category Description </ p > unsuitable for description tag, how to remove p label it? Can be achieved using the following code

<?php $cat_des = category_description(); echo str_replace(array("<p>","","</p>", "\r", "\n"),"",$cat_des);?>

  Another method is to define the current document theme function.php

//分类描述删除p标签
function ytkah_delete_cat_p($description) {
  $description = trim($description);
  $description = strip_tags($description,"");
  return ($description);
}
add_filter('category_description', 'ytkah_delete_cat_p'); 

  Reference article http://www.xintheme.com/wpjiaocheng/49754.html

Guess you like

Origin www.cnblogs.com/ytkah/p/11308732.html