count_posts to a standalone link

You can use wp_count_posts

Example using code above:

$count_posts = wp_count_posts('post');

if ( $count_posts ) {
    $published_posts = $count_posts->publish;
}

<a href="https://wordpress.stackexchange.com/questions/250800/YOUR_LINK">YOUR TEXT <?php echo $published_posts; ?></a>

error code: 523