
wordpress建站seo优化的时候会用到描述,下面web建站小编给大家简单介绍一下如何利用wordpress自带的term_description函数获取分类描述信息!
函数源码:
function term_description( $term = 0, $deprecated = null ) {
  if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
  	$term = get_queried_object();
  	if ( $term ) {
  	  $term = $term->term_id;
  	}
  }
  
  $description = get_term_field( 'description', $term );
  
  return is_wp_error( $description ) ? '' : $description;
}
调用方法:
<?php echo 'Term Description: ' . term_description( '12','post_tag' ); ?>
WordPress如何利用Python脚本实现文章定时发布功能
标签: term_description, wordpress分类描述, wordpress建站技巧
上面是“wordpress优化如何获取分类描述信息(term_description)”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_4458.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

 php语法如何将数组转成JSON格式
 php语法如何将数组转成JSON格式 腾讯微卡免费开通入口
 腾讯微卡免费开通入口