Skip to content

Commit

Permalink
Audit usage of block extensions when blocks disabled (#39070)
Browse files Browse the repository at this point in the history
* Check map_block_from_geo_points function exists, and require the file if it doesn't

* changelog

---------

Co-authored-by: Karen Attfield <[email protected]>
  • Loading branch information
darssen and coder-karen authored Aug 28, 2024
1 parent 84631d5 commit cd69286
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Blocks: Ensure function is loaded even if blocks aren't enabled
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,9 @@ private function dtp_fb_preprocess_post( $post, $metadata ) {
'title' => $fb_point['name'],
);
}
if ( ! function_exists( 'map_block_from_geo_points' ) ) {
require_once JETPACK__PLUGIN_DIR . 'extensions/blocks/map/map.php';
}
$map_block = map_block_from_geo_points( $geo_points );

$post['post_content'] = $map_block . $post['post_content'];
Expand Down

0 comments on commit cd69286

Please sign in to comment.