Lego2012
12/13/2016 - 2:53 PM

Get a category URL by name

Get a category URL by name

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

/**
 * Return a the URL for a given category
 * @param  string $name 'Category Name'
 * @return string URL
 */
function wellma_get_category_url( $name ) {
    return esc_url( get_category_link( get_cat_ID( esc_attr($name) ) ) );
}