Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#54435 new defect (bug)

admin-ajax.php : 404 Error

Reported by: mayhem30's profile Mayhem30 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

The admin-ajax.php file is throwing a 404 error when you click on the X to close the theme customization screen.

(/wp-admin/customize.php?return=%2Fwp-admin%2Fthemes.php)

The admin-ajax.php file does return a proper 200 code when modifying any theme settings.

Change History (2)

#1 @Mayhem30
3 years ago

It's been almost 2 months and my error log is filled with these errors.

No one has a fix for this?

#2 @here
3 years ago

I found this investigating a similar issue and it turns out this behavior is as designed.

Steps to repro:

  1. Open Customizer
  2. Click X to close Customizer

Observed: 404 error requesting admin-ajax.php
Expected: No errors

For my case, searching for the admin-ajax action value used in the POST request "customize_dismiss_autosave_or_lock" leads to the associated core code.

WordPress core code that is returning the 404 can be seen here, https://github.com/WordPress/WordPress/blob/99bac7e17cfb5d534b33ffc3a70bff9d9b86875d/wp-includes/class-wp-customize-manager.php#L3693-L3695

Sample POST payload

wp_customize: on
customize_theme: example-theme
customize_changeset_uuid: ac3050d5-df08-4c20-a8e9-88fa37974652
nonce: 6a2eb1176f
dismiss_autosave: false
dismiss_lock: true
action: customize_dismiss_autosave_or_lock
customize_preview_nonce: b43e42ab81

A sample request / response body is

$ curl 'https://example.com/wp-admin/admin-ajax.php'
...
--data-raw 'wp_customize=on&customize_theme=example-theme&customize_changeset_uuid=9fd9e3ff-7209-4a6b-9a2e-708e5e2bf5fa&nonce=993d76371b&dismiss_autosave=false&dismiss_lock=true&action=customize_dismiss_autosave_or_lock&customize_preview_nonce=c893d9add4' \
...
< HTTP/2 404 
...
{"success":false,"data":"no_auto_draft_to_delete"}
Note: See TracTickets for help on using tickets.