Recently I need Help regarding this permalink shortcode
function my_permalink(){
ob_start();
the_permalink();
return ob_get_flush();}
add_shortcode('my_permalink','my_permalink');
for this, I get a shortcode [my_permalink], it's working fine
But the problem is when I use this shortcode on my WordPress Posts, Pages, CPT, CT or any custom Archive Page it shows me some unnecessary link text which is at top of the loop and also it does not include any HTML tag
I am showing the screenshot and the link appearing position in the posts
Code:
</div>
<div class="entry-content">
https://careerfeed.net/jobs/kfri-recruitment-2021-for-1-project-assistant/<div class="wprt-container"><p>KFRI Recruitment 2021 for 1 Project Assistant Applications are invited from eligible candidates for the post of one <b>Project Assistant </b>under the project KFRI/RP 823/2021 entitled “Ecological studies on post restoration success of threatened plants in situ.”</p>
https://careerfeed.net/jobs/kfri-recruitment-2021-for-1-project-assistant/
<p> </p>
Screenshot: The URL appears:
I just paste the shortcode:
Inside inspect Elements:
add_shortcode( 'my_permalink', 'get_the_permalink' );
Since there's already a function for returning the permalink.