Shortcode – Getting Categories appears on top of website
A few things: You’re running your add_shortcode() function in wp_head. You don’t need to do that. Your life_shortcode() function is returning a value, not echoing it. So it’s not going to be caught by the output buffer and ob_get_clean() will return nothing. wp_list_categories() is echoing, so is not going to be properly put into $mycats … Read more