Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22763 closed defect (bug) (invalid)

add_query_arg() returns the ajaxurl

Reported by: 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 "www.example.com/wp-admin/admin-ajax.php?paged=2".

Change History (5)

#1 @nacin
3 years ago

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

#2 @markoheijnen
3 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
3 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
3 years ago

You can check if DOING_AJAX is defined

#5 @helenyhou
3 years ago

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