Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Contortion on "How to get category slug or ID in core functions.php"

$
0
0

How can i get the category slug in core functions.php for use in the function wp_upload_dir()?

I have tried all the following without success

//$uploadcat =  get_the_category_by_ID(2); // works but need to find how to get ID
	//$subdir = '/' . $id;
	//$subdir = '/' . get_query_var('cat');
	//$subdir = '/' . $post->ID;
	//$subdir = '/' . $cat_ID;
	//$subdir = '/' . get_the_ID();
	//$subdir = '/' . the_ID();
	//$subdir = '/' . get_the_category(); returns array, empty?
	//$subdir = '/' . the_category();

Viewing all articles
Browse latest Browse all 8245

Trending Articles