Get post / page ID from ACF Link field

The Page Link documentation actually shows how to retrieve the ID from a Page Link field. Just needed to do this myself and came across it. It worked well for me.

<?php 

// vars
$post_id = get_field('url', false, false);

// check 
if( $post_id ): ?>
<a href="https://wordpress.stackexchange.com/questions/304960/<?php echo get_the_permalink($post_id); ?>"><?php echo get_the_title($post_id); ?></a>
<?php endif; ?>

The “false, false” parameters allow you to retrieve more details.

error code: 523