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 “https://myurl.com/user/username/&action=download_csv_bc&_wpnonce=3a9caf44cb” 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.)