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

Add deprecation shim for __experimentalPluginPostExcerpt #61219

Closed
peterwilsoncc opened this issue Apr 29, 2024 · 7 comments · Fixed by #61238
Closed

Add deprecation shim for __experimentalPluginPostExcerpt #61219

peterwilsoncc opened this issue Apr 29, 2024 · 7 comments · Fixed by #61238
Assignees
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Bug An existing feature does not function as intended

Comments

@peterwilsoncc
Copy link
Contributor

peterwilsoncc commented Apr 29, 2024

Description

wp.editPost.__experimentalPluginPostExcerpt was exposed as an accessible API in WordPress 6.5 and subsequently deprecated in #61188 with a no-op function.

This breaks backward compatibility for extenders using the API so the deprecation needs to be fixed to provide a shim for the recommended process for adding content to such panels.

Step-by-step reproduction instructions

POC plugin:

import { registerPlugin } from '@wordpress/plugins';
import { __experimentalPluginPostExcerpt } from '@wordpress/edit-post';

const PwccPostExcerpt = () => {
	return (
		<__experimentalPluginPostExcerpt className="pwcc-post-excerpt">
			Post Excerpt - Custom content
		</__experimentalPluginPostExcerpt>
	);
}

registerPlugin( 'pwcc-post-excerpt', { render: PwccPostExcerpt } );
  1. Create and build the POC plugin above.
  2. Checkout 4abdb39 or earlier
  3. Create a new post and open the excerpt panel
  4. At the bottom of the panel the text "Post Excerpt - Custom content" will display
  5. Checkout trunk
  6. Create a new post and open the excerpt panel
  7. The plugin's text will no longer be displayed

Screenshots, screen recording, code snippet

WordPress trunk

Screen Shot 2024-04-30 at 9 10 11 am

Gutenberg 4abdb39

Screen Shot 2024-04-30 at 8 46 06 am

Gutenberg trunk

Screen Shot 2024-04-30 at 8 44 57 am

Environment info

  • WordPress/WordPress master at 9a2a3dc5b3ed97ae7a894b65576227b033ec0e86
  • Gutenberg trunk at 5b154e5

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@peterwilsoncc peterwilsoncc added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability labels Apr 29, 2024
@retrofox
Copy link
Contributor

Hi, Peter. Thanks for creating this issue. 🙇‍♂️

The report is valid and logical.
However, the metrics indicate that external developers are not using the experimental plugin. Additionally, considering that the plugin API is not straightforward, well-defined, and diverges from the usual ways developers customize panels, I believe it is safe to deprecate and make it obsolete at this time.

@pdewouters
Copy link

@retrofox @peterwilsoncc thanks, so what's the recommended approach? I have some pending code changes using __experimentalPluginPostExcerptto add some text to the excerpt metabox, but if I understand correctly, this is deprecated in 6.6? So I'd rather avoid committing this and use a method that will still work in future.

@retrofox
Copy link
Contributor

retrofox commented Apr 30, 2024

👋 Paul, do you think you could do it following these guidelines? https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically
If so, you won't need the __experimentalPluginPostExcerpt. It will prevent you from using something that will soon be deprecated.

@pdewouters
Copy link

@retrofox so you mean remove it and add a custom one?

@retrofox
Copy link
Contributor

You don't need the __experimentalPluginPostExcerpt to customize the post excerpt panel. For instance, we created a custom post excerpt with AI in the Jetpack plugin. You can probably do something similar.

@youknowriad
Copy link
Contributor

I didn't realize that we actually nooped the component, I'm fine restoring the component as it was with a deprecation. We can noop in a future version.

@retrofox
Copy link
Contributor

let's restore it then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants