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

Yoast SEO sidebar doesn't save the metadata on block editor when the Yoast SEO metabox is disabled #21851

Closed
4 of 11 tasks
shabnam611 opened this issue Nov 21, 2024 · 3 comments
Closed
4 of 11 tasks

Comments

@shabnam611
Copy link

shabnam611 commented Nov 21, 2024

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

If Yoast SEO metabox is disabled, then Yoast SEO sidebar doesn't save the metadata like SEO title, meta description. Also, this data does not appear in the page source and remains missing from the post overview page as well.

This issue with saving data applies not only to the SEO title/description but also to all our settings added via the sidebar.

To Reproduce

Step-by-step reproduction instructions

  1. Disable Yoast SEO metabox from post editor > Preference > General > Advanced and disable the Yoast SEO toggle button.
  2. Add a new post, use the Search Appearance tab of Yoast SEO sidebar to add the meta description [for example]
  3. Publish the post. Refresh the page and open the Search Appearance tab of Yoast SEO sidebar.

Expected results

  1. The data added via Yoast SEO sidebar should remain saved without metabox being enabled.

Actual results

  1. Metadata is not being saved in the Yoast SEO sidebar

Screenshots, screen recording, code snippet

https://www.loom.com/share/bdf879f26d67454caca89aa7b6c3de0b

Technical info

  • If relevant, which editor is affected (or editors):
  • Block Editor
  • Gutenberg Editor
  • Elementor Editor
  • Classic Editor
  • Other:
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other:

Used versions

  • Device you are using: Macbook pro
  • Operating system: macOS Sequoia 15.0.1
  • PHP version: 8.1
  • WordPress version: 6.7
  • WordPress Theme: Twenty Twenty Four
  • Yoast SEO version: 23.9
  • Gutenberg plugin version:
  • Elementor plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:
@shabnam611
Copy link
Author

@josevarghese josevarghese changed the title Yoast SEO sidebar doesn't save the metadata Yoast SEO sidebar doesn't save the metadata on Block editor when the Yoast SEO metabox is disabled Nov 21, 2024
@josevarghese josevarghese changed the title Yoast SEO sidebar doesn't save the metadata on Block editor when the Yoast SEO metabox is disabled Yoast SEO sidebar doesn't save the metadata on block editor when the Yoast SEO metabox is disabled Nov 21, 2024
@stokesman
Copy link

I got here from WordPress/gutenberg#67207 which has been acknowledged as a regression and a fix is in the works. It seems the earliest that WP can release with the fix will be in 6.7.2 sometime after December 2.

In case the issue is more urgent for Yoast, it seems possible to patch with something like the following:

add_action( 'enqueue_block_editor_assets', 'hotfix_initialize_meta_boxes' );
function hotfix_initialize_meta_boxes() {
	$initializer = <<<JS
		( ( { dispatch, select, subscribe } ) => {
			const unsub = subscribe( () => {
				const isEditorReady = select( wp.editor.store ).__unstableIsEditorReady();
				const isInitialized = select( wp.editPost.store ).areMetaBoxesInitialized();
				if ( isEditorReady ) {
					if ( isInitialized ) {
						unsub();
					} else {
						dispatch( wp.editPost.store ).initializeMetaBoxes();
					}
				}
			} );
		} )( wp.data );
	JS;
	wp_add_inline_script( 'wp-edit-post', $initializer );
}

Given that Yoast renders React components, I think it may be done alternatively with hooks (useSelect/useDispatch) and added to the plugins sidebar component.

@josevarghese
Copy link
Contributor

I am closing this issue as an issue has already been opened at the Gutenberg repo: WordPress/gutenberg#67207.

The issue is not specific to the Yoast SEO plugin and it can be reproducible for other plugins with metabox set as disabled and having a sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants