Get URL of logged in user’s custom post (WordPress)

I’m running a multi-vendor WP site where users can create a business profile. The profile is a custom post type (wyz-business).

I’m looking to get the URL of logged in user’s profile (custom post type).

Looking at the developer’s code, they seem to get the URL of logged in user’s business with

<?php echo get_the_permalink( $curr_id );?>

What I’m trying to achieve is to create an embed link that users can put on their websites. Below is my code from functions.php and then I embed the shortcode on user’s dashboard – BUT it’s returning the URL of the dashboard and not user’s profile:

add_shortcode(’embed-button’, ‘btn_embed’);
function btn_embed(){
?>
&lt;a href=”<?php echo get_the_permalink( $curr_id );?>”&gt;Visit My Profile&lt;/a&gt;
<?php
};

What am I doing wrong?

Read more here:: Get URL of logged in user’s custom post (WordPress)

Leave a Reply

Your email address will not be published. Required fields are marked *