Remove links from the product titles in the wishlist items table

The titles of the products in the wishlist items table on the single wishlist page are usually clickable. This allows the customer to visit the product page to learn more about the product while purchasing it. It can also help boost alternative sales as well as S.E.O. for your site.

Sometimes however, you may want to prevent customers from being able to click these titles so that they can stay on the wishlist page and buy the product as a wishlist item.

In order to do so, simply add the code below to your functions.php file.

/**
 * Remove links from the product titles in the wishlist items table
 */
add_filter( 'post_type_link', 'my_nmgr_remove_product_title_link', 10, 2 );

function my_nmgr_remove_product_title_link( $link, $post ) {
	if ( 'product' === $post->post_type &&
		did_action( 'nmgr_before_items' ) &&
		!did_action( 'nmgr_after_items' ) ) {
		$link = '';
	}
	return $link;
}