在SQL中获取自定义分类自定义字段

时间:2016-08-22 19:28:11

标签: mysql wordpress custom-taxonomy

我已经从this example

创建了自定义字段

我想通过包含" web"来获得分类法名称。在phpmyadmin的mysql查询中的custom_term_meta(创建新字段)中。

1 个答案:

答案 0 :(得分:0)

WordPress 4.4及更高内置了Term Meta:https://www.smashingmagazine.com/2015/12/how-to-use-term-meta-data-in-wordpress/

但是在您的示例中,您将术语元存储在wp_options表中。您应该通过get_option()函数获取值,如下所示:

echo get_option("taxonomy_$term_id");

...其中$ term_id是您想要获取元数据的术语的ID。

相关问题