Skip to content
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

Remove duplicate viewport and title element hooks #33797

Closed
wants to merge 1 commit into from

Conversation

jeremyfelt
Copy link
Member

Description

The hooks to inject gutenberg_viewport_meta_tag and gutenberg_render_title_tag into wp_head were shipped as part of WordPress 5.8. Having them in the Gutenberg plugin and in WordPress core results in duplicate <title> and duplicate <meta name="viewport" tags in markup.

See WordPress/wordpress-develop@ea49625

How has this been tested?

  1. View source on the front-end before the change.
  2. View source on the front-end after the change.

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • n/a I've tested my changes with keyboard and screen readers.
  • n/a My code has proper inline documentation.
  • n/a I've included developer documentation if appropriate.
  • n/a I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

The hooks to inject `gutenberg_viewport_meta_tag` and `gutenberg_render_title_tag` into `wp_head` were shipped as part of WordPress 5.8. Having them in the Gutenberg plugin and in WordPress core results in duplicate `<title>` and duplicate `<meta name="viewport"` tags in markup.

See WordPress/wordpress-develop@ea49625
@jeremyfelt
Copy link
Member Author

I guess this may actually not be the best way to remove the duplication if the Gutenberg plugin is still supporting WP pre-5.8. If that is the case, it may be better to add some function_exists() calls.

@Mamaduka Mamaduka added [Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended labels Aug 2, 2021
@Mamaduka
Copy link
Member

Mamaduka commented Aug 2, 2021

I guess this may actually not be the best way to remove the duplication if the Gutenberg plugin is still supporting WP pre-5.8. If that is the case, it may be better to add some function_exists() calls.

Yes, we have to support WP < 5.8 versions.

The current method for similar cases is to remove WP Core filters and only use hooks from the plugin. See: #33233 (comment)

@jeremyfelt
Copy link
Member Author

This was fixed in #36133 to fix #34106, which was somewhat of a duplicate of this issue.

@jeremyfelt jeremyfelt closed this Nov 25, 2021
@jeremyfelt jeremyfelt deleted the patch-1 branch November 25, 2021 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants