Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rank Math

    (@rankmath)

    Hello @sverger

    Thank you for your message.

    As from the other topic, please try the following code instead:

    add_filter( 'oembed_request_post_id', function( $post_id, $url ){
    	if ( $post_id ) {
    		return $post_id;
    	}
    	$parsed_url = wp_parse_url( $url ); // Parse URL
    	$slug = substr( $parsed_url['path'], 1 );
    	$post = get_page_by_path( $slug, OBJECT, 'product' );
    	if ( ! is_wp_error( $post ) && ! empty( $post ) ) {
    		$post_id = $post->ID;
    	}
    	return $post_id;
    }, 10, 2);

    Hope that helps.

    Thread Starter sverger

    (@sverger)

    Its works Thank you

    Plugin Author Rank Math

    (@rankmath)

    Hello @sverger

    Glad that helped.

    Please let us know if you need any other assistance, we are here to help.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘oembed 404’ is closed to new replies.