Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#56657 closed defect (bug) (invalid)

Invalid URL in class-wp-embed.php file

Reported by: vinoth06's profile vinoth06 Owned by:
Milestone: Priority: normal
Severity: blocker Version: 2.9
Component: Embeds Keywords: has-patch
Focuses: Cc:

Description

Hi,

In line https://github.com/WordPress/wordpress-develop/blob/599622ccc76d31a63c685b5657307d662d4bcae5/src/wp-includes/class-wp-embed.php#L93 there is an invalid URL structure and causing a 404 error on AJAX call.

Current Version

$.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>");

Hope it should be like

<?php
$.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '&action=oembed-cache&post=' . $post->ID; ?>");

The ? should be replaced with &.

Please let me know if the above is not clear.

Thanks

Change History (6)

#1 @SergeyBiryukov
21 months ago

  • Component changed from Cache API to Embeds
  • Keywords reporter-feedback added

Hi there, welcome back to WordPress Trac! Thanks for the report.

The URL was introduced in [12023] for WordPress 2.9, setting the version accordingly. It was further adjusted in [19871] to use a relative path and in [51177] to use escaping.

The current URL looks correct to me:

/wp-admin/admin-ajax.php?action=oembed-cache&post=123

The proposed change, on the other hand, does not look correct:

/wp-admin/admin-ajax.php&action=oembed-cache&post=123

If the current URL causes a 404 error on your install, I think there might be something else at play here. Does the issue still happen with all plugins disabled and a default theme (Twenty Twenty-Two) activated? Could you share the steps to reproduce it on a clean install?

Last edited 21 months ago by SergeyBiryukov (previous) (diff)

#2 @SergeyBiryukov
21 months ago

  • Version changed from trunk to 2.9

#3 @vinoth06
21 months ago

Thanks @SergeyBiryukov for the detailed information, Yes you are right, a custom plugin extends the admin_url hook and updating the query parameters.

Thanks again :-)

#4 @vinoth06
21 months ago

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

#5 @desrosj
21 months ago

  • Milestone Awaiting Review deleted

#6 @SergeyBiryukov
21 months ago

  • Keywords reporter-feedback removed

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.