Here is a code snippet where I tried to retrieve a custom meta data from a custom post type.
$p_client_link = get_post_meta( $post->ID, 'client_link', true );
<a href="<?php echo esc_url( $p_client_link); ?>"><?php the_post_thumbnail( 'client_logo' ); ?></a>
My queries are:
- Q. esc_url( $p_client_link); == right/wrong? esc_url() or esc_attr()?
- Q. custom meta id client_link. Is it necessary to add prefix with this custom meta id like ‘p_client_link’?
- Q. Is it right to use esc_url() for any ‘href’ attribute value?
N. B. I have been developing a one page WordPress theme for themeforest submission.
Thanks in advance. :)