WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#40673 closed defect (bug) (fixed)

WP Oembed in Multisite fails when embedded post comes from a different site of a network.

Reported by: imath Owned by: swissspidy
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.5.3
Component: Embeds Keywords: needs-patch
Focuses: multisite Cc:
PR Number:

Description

Steps to reproduce:

1/ Create a post in main site.
2/ Create a new site
3/ Go the dashboard of this site
4/ Create a new post and paste in it the permalink of the post created at step 1.

This happens when the post we're trying to embed comes from a different site. I've added some unit tests to illustrate the issue. Without the patch, these two unit tests are failing:

  • test_wp_filter_pre_oembed_result_multisite_sub_othersub
  • test_wp_filter_pre_oembed_result_multisite_sub_main

Attachments (3)

40673.patch (4.9 KB) - added by imath 3 years ago.
40673.diff (4.9 KB) - added by swissspidy 2 years ago.
40673.2.patch (906 bytes) - added by bor0 2 years ago.

Download all attachments as: .zip

Change History (15)

@imath
3 years ago

#1 @imath
3 years ago

  • Keywords has-patch has-unit-tests added

#2 @ocean90
2 years ago

  • Version changed from trunk to 4.5.3

@swissspidy How does 40673.patch look to you?

#3 @swissspidy
2 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to swissspidy
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


2 years ago

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


2 years ago

@swissspidy
2 years ago

#6 @swissspidy
2 years ago

  • Keywords commit added

Just did two minor tweaks in 40673.diff. I think this is good to go.

#7 @swissspidy
2 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41600:

Embeds: Improve performance when embedding a post on Multisite.

After [37798], this fixes embeds coming from a different site in the network.

Props imath.
Fixes #40673. See #36767.

#8 @ocean90
2 years ago

  • Keywords needs-patch added; has-patch has-unit-tests commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The use of ms_is_switched() doesn't seem to be right, see #38253 for a previous case.

@bor0
2 years ago

#9 @bor0
2 years ago

  • Keywords has-patch added; needs-patch removed

#10 @swissspidy
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 41606:

Embeds: Maintain switched state when embedding a post on Multisite.

Props bor0.
Fixes #40673.

#11 @ocean90
2 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The current blog isn't restored if $post_id is false.

#12 @ocean90
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 41634:

Embeds: In switched state, restore previous state if no post ID is found.

Fixes #40673.

Note: See TracTickets for help on using tickets.