Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22763 closed defect (bug) (invalid)

add_query_arg() returns the ajaxurl

Reported by: gualtieri's profile Gualtieri Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: General Keywords:
Focuses: Cc:


When calling any function that uses add_query_arg() by ajax, the result url is "/wp-admin/admin-ajax.php".

When using get_pagenum_link(2) for example, the result will be "".

Change History (5)

#1 @nacin
11 years ago

What resource would you expect get_pagenum_link() to return a page number for?

#2 @markoheijnen
11 years ago

  • Keywords close added

I had this once when requesting a part of a template through ajax. WordPress can't really do something with this. It's all to the ajax method to handle this and I guess this is a custom AJAX method.

The only thing you can do is set $_SERVERREQUEST_URI? to the value you want it to be.

#3 @Gualtieri
11 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

In my case, theres an ajax call that loads the pagination after the page load.

Whats happening is that add_query_arg() is getting the ajax url instead of the current user url.

I was wondering if wasnt any way to check if it is an ajax call and treat it different, facing it as an enhancement or something like this.

Ill close it.

#4 @markoheijnen
11 years ago

You can check if DOING_AJAX is defined

#5 @helenyhou
11 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution changed from maybelater to invalid
Note: See TracTickets for help on using tickets.