diff --git a/includes/utils/class-amp-validation-utils.php b/includes/utils/class-amp-validation-utils.php index d5f4497035d..3bbcbb9baeb 100644 --- a/includes/utils/class-amp-validation-utils.php +++ b/includes/utils/class-amp-validation-utils.php @@ -371,6 +371,7 @@ public static function get_source( $callback ) { $type = isset( $matches[1] ) ? $matches[1] : null; $source = isset( $matches[2] ) ? $matches[2] : null; if ( ( 'plugins' === $type ) || ( 'themes' === $type ) ) { + $type = substr( $type, 0, -1 ); return compact( 'type', 'source' ); } return null; @@ -410,9 +411,9 @@ public static function wrapped_callback( $callback ) { $output = ob_get_clean(); if ( ! empty( $output ) ) { - printf( '', esc_attr( $callback['source'] ) ); + printf( '', esc_attr( $callback['type'] ), esc_attr( $callback['source'] ) ); echo $output; // WPCS: XSS ok. - printf( '', esc_attr( $callback['source'] ) ); + printf( '', esc_attr( $callback['type'] ), esc_attr( $callback['source'] ) ); } return $result; }; diff --git a/tests/test-class-amp-validation-utils.php b/tests/test-class-amp-validation-utils.php index d64b7683b13..cc929ae741c 100644 --- a/tests/test-class-amp-validation-utils.php +++ b/tests/test-class-amp-validation-utils.php @@ -353,16 +353,16 @@ public function test_callback_wrappers() { do_action( $action_no_argument ); $output = ob_get_clean(); $this->assertContains( '
', $output ); - $this->assertContains( '