-
Notifications
You must be signed in to change notification settings - Fork 384
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
Call amp_get_schemaorg_metadata()
before output buffer processing
#6233
Call amp_get_schemaorg_metadata()
before output buffer processing
#6233
Conversation
Plugin builds for 15310db are ready 🛎️!
|
@@ -69,8 +80,6 @@ public function test_transform( $json, $expected ) { | |||
* @covers ::transform | |||
*/ | |||
public function test_empty_metadata_configuration() { | |||
add_filter( 'amp_schemaorg_metadata', '__return_empty_array' ); |
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 corresponding remove_filter()
needs to be removed as well.
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.
Removed in 15310db. It wasn't needed in the first place since filters get reset when tests are torn down.
Summary
Fixes #6232
This moves up the
amp_get_schemaorg_metadata()
call to just before output buffering starts rather than calling it after output buffering has finished. This avoids many filters/actions from being invoked which are liable to callob_start()
.👉 There is the possibility of a breaking change here. Namely, if a theme/plugin adds a
amp_schemaorg_metadata
filter oramp_post_template_metadata
filter after thetemplate_redirect
action then their function will not apply. Previously a site could add that filter at any point during template rendering. Nevertheless, it is not expected that this will be a problem.Deduplicated hooks fired before (count 173)
add_option
add_option__transient_amp-parsed-stylesheet-v36-*
add_option__transient_timeout_amp-parsed-stylesheet-v36-*
added_option
admin_url
alloptions
amp_default_options
amp_enable_optimizer
amp_enable_ssr
amp_extract_image_dimensions_batch
amp_extract_image_dimensions_batch_callbacks_registered
amp_extract_image_dimensions_get_user_agent
amp_optimizer_config
amp_post_template_metadata
amp_query_var
amp_schemaorg_metadata
amp_server_timing_log
amp_server_timing_start
amp_server_timing_stop
amp_site_icon_url
amp_to_amp_linking_element_excluded
amp_to_amp_linking_element_query_vars
amp_validation_error
amp_validation_error_sanitized
block_parser_class
content_url
default_option__transient_amp-parsed-stylesheet-v36-*
default_option__transient_timeout_amp-parsed-stylesheet-v36-*
default_option_site_logo
default_post_metadata
determine_locale
editor_max_image_size
expiration_of_transient_amp-parsed-stylesheet-v36-*
get_amp_validation_error
get_attached_file
get_avatar_data
get_avatar_url
get_meta_sql
get_post_metadata
get_post_status
get_site_icon_url
get_term
get_terms_args
get_terms_defaults
get_terms_fields
get_terms_orderby
get_user_metadata
gettext
gettext_amp
gettext_default
has_post_thumbnail
home_url
image_downsize
includes_url
infinite_scroll_archive_supported
infinite_scroll_settings
jetpack_images_get_images
jetpack_images_pre_get_images
jetpack_postimages_post_get_image
jetpack_postimages_pre_get_image
list_terms_exclusions
locale
log_query_custom_data
map_meta_cap
no_texturize_shortcodes
no_texturize_tags
option__transient_amp-parsed-stylesheet-v36-*
option__transient_amp_remote_request_*
option__transient_timeout_amp-parsed-stylesheet-v36-*
option__transient_timeout_amp_remote_request_*
option_amp-options
option_avatar_default
option_avatar_rating
option_blog_charset
option_blogname
option_comments_per_page
option_home
option_page_on_front
option_permalink_structure
option_show_on_front
option_site_icon
option_siteurl
option_stylesheet
option_stylesheet_root
option_template
option_theme_mods_twentytwentyone
option_timezone_string
parse_query
parse_tax_query
parse_term_query
post_limits
post_limits_request
post_link
posts_clauses
posts_clauses_request
posts_distinct
posts_distinct_request
posts_fields
posts_fields_request
posts_groupby
posts_groupby_request
posts_join
posts_join_paged
posts_join_request
posts_orderby
posts_orderby_request
posts_pre_query
posts_request
posts_search
posts_selection
posts_where
posts_where_paged
posts_where_request
pre_determine_locale
pre_get_avatar_data
pre_get_posts
pre_get_table_charset
pre_get_terms
pre_option__transient_amp-parsed-stylesheet-v36-*
pre_option__transient_amp_remote_request_*
pre_option__transient_timeout_amp-parsed-stylesheet-v36-*
pre_option__transient_timeout_amp_remote_request_*
pre_option_amp-options
pre_option_avatar_default
pre_option_avatar_rating
pre_option_blog_charset
pre_option_blogname
pre_option_comments_per_page
pre_option_home
pre_option_page_on_front
pre_option_permalink_structure
pre_option_show_on_front
pre_option_site_icon
pre_option_site_logo
pre_option_siteurl
pre_option_stylesheet
pre_option_stylesheet_root
pre_option_template
pre_option_theme_mods_twentytwentyone
pre_option_timezone_string
pre_post_link
pre_set_transient_amp-parsed-stylesheet-v36-*
pre_transient_amp-parsed-stylesheet-v36-*
pre_transient_amp_remote_request_*
query
sanitize_key
sanitize_option__transient_amp-parsed-stylesheet-v36-*
sanitize_option__transient_timeout_amp-parsed-stylesheet-v36-*
sanitize_title
set_transient_amp-parsed-stylesheet-v36-*
set_url_scheme
setted_transient
show_admin_bar
site_url
stylesheet
stylesheet_directory_uri
template
template_directory_uri
terms_clauses
terms_pre_query
the_title
theme_mod_custom_logo
theme_root_uri
transient_amp-parsed-stylesheet-v36-*
transient_amp_remote_request_*
upload_dir
user_has_cap
user_trailingslashit
wp_constrain_dimensions
wp_get_attachment_image_src
wp_get_attachment_metadata
wp_get_attachment_url
wp_parse_str
Deduplicated hooks fired after (count 91)
add_option
add_option__transient_amp-parsed-stylesheet-v36-*
add_option__transient_timeout_amp-parsed-stylesheet-v36-*
added_option
admin_url
alloptions
amp_default_options
amp_enable_optimizer
amp_enable_ssr
amp_extract_image_dimensions_batch
amp_extract_image_dimensions_batch_callbacks_registered
amp_extract_image_dimensions_get_user_agent
amp_optimizer_config
amp_query_var
amp_server_timing_log
amp_server_timing_start
amp_server_timing_stop
amp_to_amp_linking_element_excluded
amp_to_amp_linking_element_query_vars
amp_validation_error
amp_validation_error_sanitized
content_url
default_option__transient_amp-parsed-stylesheet-v36-*
default_option__transient_timeout_amp-parsed-stylesheet-v36-*
determine_locale
expiration_of_transient_amp-parsed-stylesheet-v36-*
get_amp_validation_error
get_meta_sql
get_term
get_terms_args
get_terms_defaults
get_terms_fields
get_terms_orderby
gettext
gettext_amp
gettext_default
home_url
includes_url
list_terms_exclusions
locale
log_query_custom_data
map_meta_cap
option__transient_amp-parsed-stylesheet-v36-*
option__transient_amp_remote_request_*
option__transient_timeout_amp-parsed-stylesheet-v36-*
option__transient_timeout_amp_remote_request_*
option_amp-options
option_home
option_siteurl
option_stylesheet
option_stylesheet_root
option_template
parse_term_query
pre_determine_locale
pre_get_table_charset
pre_get_terms
pre_option__transient_amp-parsed-stylesheet-v36-*
pre_option__transient_amp_remote_request_*
pre_option__transient_timeout_amp-parsed-stylesheet-v36-*
pre_option__transient_timeout_amp_remote_request_*
pre_option_amp-options
pre_option_home
pre_option_siteurl
pre_option_stylesheet
pre_option_stylesheet_root
pre_option_template
pre_set_transient_amp-parsed-stylesheet-v36-*
pre_transient_amp-parsed-stylesheet-v36-*
pre_transient_amp_remote_request_*
query
sanitize_key
sanitize_option__transient_amp-parsed-stylesheet-v36-*
sanitize_option__transient_timeout_amp-parsed-stylesheet-v36-*
sanitize_title
set_transient_amp-parsed-stylesheet-v36-*
set_url_scheme
setted_transient
show_admin_bar
site_url
stylesheet
stylesheet_directory_uri
template
template_directory_uri
terms_clauses
terms_pre_query
theme_root_uri
transient_amp-parsed-stylesheet-v36-*
transient_amp_remote_request_*
user_has_cap
user_trailingslashit
wp_parse_str
Diff (removed count: 91 or 47%)
173 - 91 = 82 unique hooks prevented from running during output buffer processing:
Checklist