Untitled

Anonymous
plain_text
01/22/2025 12:58 PM
776 B
20
Indexable
if ($customCategoryOne) { 
	$custom_term = get_term_by('name', $customCategoryOne, 'insight-category');

	// Check if $custom_term is valid before getting the link
	$category_link = get_term_link($custom_term);

	if (!is_wp_error($category_link)) {
		$category_link = esc_url($category_link);
	} else {
		$category_link = ''; // Handle the error case, possibly with a default URL
	}

} else {
	$category_link = get_term_link($primary);

	if (!is_wp_error($category_link)) {
		$category_link = esc_url($category_link);
	} else {
		$category_link = ''; // Handle the error case
	}
}
Editor is loading...
Leave a Comment