I don't get how to use wp_insert_link correctly.
I used the code from reference
<?php
$linkdata = array(
'link_name' => 'WordPress Code Reference',
'link_url' => 'https://developer.wordpress.org/reference'
);
$link_id = wp_insert_link( $linkdata );
?>
and also tried to integrate in some html tags like inside <div>
, <a>
or <p>
or without them, but not able to see the result in the page.
For example I tried
<a href =<?php wp_insert_link('users.php')?>>test</a>
<a href =<?php echo wp_insert_link('users.php')?>>test</a>
The hyperlink appears, but it is not redirecting to any page.
Please suggest what I am missing.