File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ parameters:
1313 - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
1414 - vendor/php-stubs/wordpress-tests-stubs/wordpress-tests-stubs.php
1515 type_coverage :
16- return_type : 87.7
16+ return_type : 87.6
1717 param_type : 79.1
1818 property_type : 0 # We can't use property types until PHP 7.4 becomes the plugin's minimum version.
1919 print_suggestions : false
Original file line number Diff line number Diff line change @@ -118,10 +118,17 @@ public function handle_preview_template(): void {
118118 *
119119 * @since 3.19.0
120120 *
121- * @param string $content The post content.
122- * @return string The modified content with wrapper div if needed.
121+ * @param mixed $content The post content.
122+ * @return mixed The modified content with wrapper div if needed, or the
123+ * unmodified content value in case of a non-string.
123124 */
124- public function add_parsely_preview_wrapper ( string $ content ): string {
125+ public function add_parsely_preview_wrapper ( $ content ) {
126+ if ( ! is_string ( $ content ) ) {
127+ // $content should always be a string, but is filterable by `the_content`.
128+ // If we get a non-string value, return it as is to avoid fatal errors.
129+ return $ content ;
130+ }
131+
125132 if ( ! isset ( $ _GET ['parsely_preview ' ] ) || 'true ' !== $ _GET ['parsely_preview ' ] ) {
126133 return $ content ;
127134 }
You can’t perform that action at this time.
0 commit comments