Wordpress How to get product permalink in php a href link

546 views Asked by At

I'm using this line of code to display a button that will link to a specific product create by the author of a page:

<a class="button" a href="https://example.com/permalink-<?php the_author_meta('user_login'); ?>"> Take me there <?php the_author_meta('user_firstname')?></a>

Everything work fine, but I just need to adjust one think. The "permalink" text is in reality the product permalink the I set in wordpress admin page.

Now in my template I actually put that permalink without php code, and I think that the moment that I will decide to change product permalink to another value, it will take me to a 404 page.

How can I replace the actual permalink name with a php code that is able to find the right permalink no matter how and when I change it?

Thank you!

0

There are 0 answers