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);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论