Php 在Ajax刷新后获取页面url

Php 在Ajax刷新后获取页面url,php,ajax,wordpress,url,Php,Ajax,Wordpress,Url,在wordpress中,我的functions.php中有一段特殊的代码 function add_legend_explanation($html) { $categories = array( 'category/1to1/', 'category/core/', 'category/couples/', 'category/cpd/', 'category/international/', 'category/open/',

在wordpress中,我的functions.php中有一段特殊的代码

function add_legend_explanation($html) {
  $categories = array(
    'category/1to1/', 
    'category/core/', 
    'category/couples/',
    'category/cpd/', 
    'category/international/', 
    'category/open/', 
    'category/organisational/'
  ); 
  $url = $_SERVER['REQUEST_URI'];
  $newurl = str_replace($categories, "", $url);
  echo '<a href="', $newurl, '">test me</a>' .$html;
它在xampp本地运行

我该如何解决这个问题,因为URL栏显示了正确的URL,我快疯了


编辑:或者有人能告诉m如何将php函数更改为工作的jquery函数吗?也许这样会更好?

我认为问题在于,您需要防止默认设置,这是指向下个月的链接的href吗?不,如果我将上个月的链接悬停,则该链接显示我在2014-05页。
wp-admin/admin-ajax.php