Skip to content

Commit

Permalink
Stop parsing content if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwoodnz committed Jul 11, 2023
1 parent ff37454 commit be048ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mu-plugins/blocks/time/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function init() {
* @return string Content with display times reformatted.
*/
function transform_time_blocks( $content) {
if ( empty( $content ) ) {
return $content;
}

// Find the time block elements by the classname "wporg-time"
$dom = new \DOMDocument();
$dom->loadHTML( $content );
Expand Down Expand Up @@ -169,5 +173,5 @@ function() {
} );
} )();
</script>
<?php
<?php
}

0 comments on commit be048ab

Please sign in to comment.