php - 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

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 "/&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.)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744946769a4602666.html

相关推荐

  • php - 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

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信