• I am writing handler for save_post action, and I need to get list of categories and tags of saved post. Unfortunately this code doesn’t work for me:

    function save_post($post_ID)
    {
    	echo "<pre>\n";
    	$cats = wp_get_post_categories($post_ID);
    	print_r($cats);
    	$tags = wp_get_post_tags($post_ID);
    	print_r($tags);
    	die("");
    }

    Both wp_get_post_categories() and wp_get_post_tags() returns empty arrays. Why this code doesn’t work? Is any other way to get categories and tags in save_post handler (or at least count of them)?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘How to get categories and tags?’ is closed to new replies.