post custom field (link and php) output
-
HI,
I have one post custom field, the field contain either a link attribute<a href="https://google.com">View</a>
or a php code<?php echo do_shortcode('[shortcode]'); ?>
Which is the best method to get a output
1.
<?php echo '<div>'.ob_start() . eval('?>' . $link44 ) .ob_get_clean() .'</div>'; ?>
this code give output for the both types link and php but a number 1 is appear before the code https://prnt.sc/utGlqDEoTaX22.
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'custom_beta', true)); ?>
this code give output for the link and not for php(but it give output if custom field contain only shortcode ([shortcode])).the above two methods are safe to use or not else any alternative code is available.
- The topic ‘post custom field (link and php) output’ is closed to new replies.