Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
Custom permalinks display a 404 error for oembed links.
Solution:
If you're experiencing this issue, we recommend you try the following steps:
1. Open the wp-content\plugins\custom-permalinks\includes\class-custom-permalinks-frontend.php file.

2. Replace the following snippet (Custom_Permalinks_Frontend::oembed_request() method) at line 497:

public function oembed_request( $post_id, $oembed_url ) {
	global $wpdb;

	/*
	 * First, search for a matching custom permalink, and if found
	 * generate the corresponding original URL.
	 */
	$original_url = null;
	$oembed_url   = str_replace( home_url(), \'\', $oembed_url );

with

public function oembed_request( $post_id, $oembed_url ) {
	global $wpdb;

	/*
	 * First, search for a matching custom permalink, and if found
	 * generate the corresponding original URL.
	 */
	$original_url = null;
	$oembed_url   = str_replace( get_option('home'), \'\', $oembed_url );

This solution might be irrelevant due to being outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 1 replies, has 2 voices.

Last updated by Shekhar Bhandari 2 years, 11 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
June 22, 2022 at 5:43 am #11515861

muhammadO-2

Custom permalinks shows 404 for oembed links

June 27, 2022 at 10:47 am #11549907

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

We saw that the issue similar was reported here: https://wordpress.org/support/topic/oembed-links-not-working/

In the meantime, follow the below steps to fix the issue:

- Open the wp-content\plugins\custom-permalinks\includes\class-custom-permalinks-frontend.php file
- Replace the following snippet (Custom_Permalinks_Frontend::oembed_request() method) at line 497:

public function oembed_request( $post_id, $oembed_url ) {
		global $wpdb;

		/*
		 * First, search for a matching custom permalink, and if found
		 * generate the corresponding original URL.
		 */
		$original_url = null;
		$oembed_url   = str_replace( home_url(), '', $oembed_url );

with

public function oembed_request( $post_id, $oembed_url ) {
		global $wpdb;

		/*
		 * First, search for a matching custom permalink, and if found
		 * generate the corresponding original URL.
		 */
		$original_url = null;
		$oembed_url   = str_replace( get_option('home'), '', $oembed_url );

Let me know if this helps.

Thanks