-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conflict by disabling Yoast initialization on Divi preview #6342
Conversation
includes/3rd-party/divi.php
Outdated
* It avoids an existing conflict that prevents the preview from loading. | ||
*/ | ||
function sensei_fix_divi_yoast_conflict() { | ||
if ( isset( $_GET['et_block_layout_preview'] ) && '1' === $_GET['et_block_layout_preview'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ideal would be to also have a check to run it only in lessons with Learning Mode, but it's too early to check this.
Codecov Report
@@ Coverage Diff @@
## trunk #6342 +/- ##
=========================================
Coverage 45.97% 45.97%
Complexity 9546 9546
=========================================
Files 459 459
Lines 33831 33829 -2
Branches 275 275
=========================================
Hits 15553 15553
+ Misses 18073 18071 -2
Partials 205 205
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the described issue. I wonder if after this is merged we should transfer your notes to a new issue. It makes sense to me to merge this now, but we should probably prioritize finding a less blunt solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just had a thought. This allows non-authenticated users to prevent loading Yoast from any request. It seems a bit too powerful. Is there a way we can restrict it just to the required request?
Hi Jake! Thank you for your review! That's a great point! Since it's in the
Totally agree! For now, I just added this comment to the original issue, changing it to low priority. So we can keep all the history of this issue in the same issue. Does it make sense? |
@jom, I checked that we could check the user roles ( Update: I also added another check to remove the action only when it's a lesson with learning mode enabled. 86d4422 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for picking this one up. 🪂
Fixes temporarily #6112
Changes proposed in this Pull Request
My findings from the investigation
\add_action( 'wpseo_head', [ $this, 'present_head' ], -9999 );
in Yoast will make it call theget_the_excerpt
(Post_Helper::get_the_excerpt
). If we don't call theget_the_excerpt
there, the problem doesn't happen.ET_Builder_Element::reset_element_indexes
. It seems it tries to fix something related tothe_content
recursions. And my suspicious is that it has something related to the problem because with the Learning Mode we make some nestedthe_content
calls inSensei\Blocks\Course_Theme\Course_Content::render_content
.Testing instructions
trunk
.