Skip to content

Commit

Permalink
Fix output buffering hooks to locate sources by wrapping hooks after …
Browse files Browse the repository at this point in the history
…*after* overall buffer
  • Loading branch information
westonruter committed Apr 29, 2018
1 parent 261c1ea commit f075298
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ public static function add_hooks() {
*/
add_action( 'template_redirect', array( __CLASS__, 'start_output_buffering' ), 0 );

// Add validation hooks *after* output buffering has started for the response.
if ( AMP_Validation_Utils::should_validate_response() ) {
add_action( 'template_redirect', array( 'AMP_Validation_Utils', 'add_validation_hooks' ), 1 );
}

// Commenting hooks.
add_filter( 'wp_list_comments_args', array( __CLASS__, 'set_comments_walker' ), PHP_INT_MAX );
add_filter( 'comment_form_defaults', array( __CLASS__, 'filter_comment_form_defaults' ) );
Expand All @@ -272,10 +277,6 @@ public static function add_hooks() {
remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
add_filter( 'wp_kses_allowed_html', array( __CLASS__, 'whitelist_layout_in_wp_kses_allowed_html' ), 10 );

if ( AMP_Validation_Utils::should_validate_response() ) {
AMP_Validation_Utils::add_validation_hooks();
}

// @todo Add character conversion.
}

Expand Down

0 comments on commit f075298

Please sign in to comment.