-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Hooks and filters support and documentation #1316
Comments
I've made an overview of actions and filters that are removed with Gutenberg so far using https://wordpress.org/plugins/debug-bar-actions-and-filters-addon/ post-new.phpActions removed (15)
Filters removed (1)
Actions added (8)
Filters added (7)
post.php?action=editActions removed (20)
Filters removed (1)
Actions added (4)
Filters added (7)
|
We need to address these better as part of MVP. The minimal thing we should do is deprecate these in an orderly fashion instead of plainly removing. In Yoast SEO we have the following function: /**
* Shows deprecation warnings to the user if a plugin has registered a filter we have deprecated.
*/
public function show_hook_deprecation_warnings() {
global $wp_filter;
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return false;
}
// WordPress hooks that have been deprecated since a Yoast SEO version.
$deprecated_filters = array(
'wpseo_metadesc_length' => array(
'version' => '3.0',
'alternative' => 'javascript',
),
'wpseo_metadesc_length_reason' => array(
'version' => '3.0',
'alternative' => 'javascript',
),
'wpseo_body_length_score' => array(
'version' => '3.0',
'alternative' => 'javascript',
),
'wpseo_linkdex_results' => array(
'version' => '3.0',
'alternative' => 'javascript',
),
'wpseo_snippet' => array(
'version' => '3.0',
'alternative' => 'javascript',
),
'wp_seo_get_bc_title' => array(
'version' => '5.8',
'alternative' => 'wpseo_breadcrumb_single_link_info',
),
'wpseo_stopwords' => array(
'version' => '6.4',
'alternative' => null,
),
'wpseo_redirect_orphan_attachment' => array(
'version' => '6.4',
'alternative' => null,
),
);
// Determine which filters have been registered.
$deprecated_notices = array_intersect(
array_keys( $deprecated_filters ),
array_keys( $wp_filter )
);
// Show notice for each deprecated filter or action that has been registered.
foreach ( $deprecated_notices as $deprecated_filter ) {
$deprecation_info = $deprecated_filters[ $deprecated_filter ];
_deprecated_hook(
$deprecated_filter,
'WPSEO ' . $deprecation_info['version'],
$deprecation_info['alternative']
);
}
} We should consider including something like this in Gutenberg as well, at least for the new editor page. |
Related PR: #4674. There is some discussion how to add hooks support for all actions related to data changes. |
Re:
I use a trace plugin that reports all the hooks and filters to an output file at shutdown. It is an enormous list of hooks. I won't show you all of the 11,000 hook and filters run on wp-admin/post-new.php
|
I think the issue is not just about actions and filters that are removed, but also about the ones that won't work or have any effect any longer. For example. |
Just a heads up that I'm working on a more specific migration guide and welcome everyone's input. |
Closing this issue as it's now an ongoing project (https://github.com/danielbachhuber/gutenberg-migration-guide) and also tracked with #4151. Feel free to open issues / PRs in that repo as you find specific integration points you want to document. |
Stripping this out from #1164. see the point touched by @hedgefield, as I'm not aware of any public discussion happened around this:
The current WordPress edit post screen provides a good amount of hooks and filters. I'm not even sure there's a list of all the known hooks/filters that run in that page or if there's an easy way to programmatically get a list.
However, Gutenberg is going to replace relevant parts of, if not almost all, the edit post screen. I think it would be reasonable (I'd say even necessary) to publish a list of:
Ideally, this should happen as soon as possible, and at least a few months before Gutenberg gets merged to give plugin/theme authors the time required to adapt their code.
The text was updated successfully, but these errors were encountered: