开发者

Find post categories or tags when editing a post

I'm trying to figure out how to find a post category or tag when editing a post in wp-admin.

I need this because I w开发者_StackOverflow中文版ant to show some modules in the editor only for a post of a certain category.

Is there a way to accomplish that result?


You can use the get_the_category() function to get the categories of the current post. From the codex:

global $post;
$categories = get_the_category($post->ID);
var_dump($categories);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜