How to retrieve current wordpress profile page URL?


I’m trying to allow users to export their own profile info to a CSV using a link on their profile. Everything works except the $url path of the link. Here’s what I have:

$url = $_GET['uri'];
$nonce = wp_create_nonce( 'download_csv' );
return '<a href="'. $url. '&action=download_csv_bc&_wpnonce='. $nonce.'" class="page-title-action">Export to CSV</a>';

This outputs “” and results in a Page Not Found when clicked.

I can successfully export data from my plugin in the admin area with the following path just fine:

$url = admin_url( 'admin.php?page=myplugin-settings-page' );

But now that I’m trying to export from the front end I’m having issues. I have also tried the following examples which doesn’t work either:

$url = admin_url( 'users.php' );
$url = admin_url( 'profile.php' );

(Not sure if it matters, but I am using Ultimate Member for profiles.)


>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="">

How to retrieve current wordpress profile page URL?</a>
, , , , John Smithly 6 months 0 Answers 41 views 0

Leave an answer