Link the custom field to the URL of the post

Content Views Pro helps you to show custom fields easily. By default, value of fields will be shown as they were added.
If you want to link the shown custom field to the URL of post which contains that custom field, please add this code to file functions.php of your active theme:

// Content Views Pro - Link custom field to post URL
add_filter( 'pt_cv_ctf_value', 'cvp_theme_ctf_link_to_post', 100, 3 );
function cvp_theme_ctf_link_to_post( $args, $key, $post ) {
	if ( $key == 'NAME_OF_FIELD' ) {
		$args = sprintf( '<a href="%s">%s</a>', get_permalink( $post ), $args );

	return $args;

(Please replace NAME_OF_FIELD with name of your custom field)

Best regards,

Scroll to Top