Get URL for featured image for posts? [closed]

The function to use would be:

$url = get_the_post_thumbnail_url();

However, that’s not the most helpful for you right now, so we have a meta field with placeholders that you need to swap out for URLs before outputting.

breaking that down we get these smaller steps:

// grab the field
// grab the URL
// swap the placeholder out for the URL
// output the field

So lets do each individual bit:

// grab the field
$meta = get_post_meta( ....

// grab the URL
$thumb_url = get_the_post_thumbnail_url();

// swap the thumbnail placeholder out for the URL
$meta = str_replace( '%thumbnail%', $thumb_url, $meta );

// output the meta field
echo wp_kses_post( $meta );

Notice the wp_kses_post which strips out dangerous HTML while letting you keep img tags etc