Skip to content

Commit

Permalink
Fix fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyc committed Jun 22, 2023
1 parent 6125bbf commit ef4a278
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ function get_gutenberg_templates(string $post_type): array
function get_gutenberg_template(string $template)
{
global $wp_gutenberg_templates;
if (empty($wp_gutenberg_templates)) {
return null;
}
foreach ($wp_gutenberg_templates as $post_type => $templates) {
if (isset($templates[$template])) {
return $templates[$template];
Expand All @@ -59,6 +62,9 @@ function get_gutenberg_template(string $template)
function get_gutenberg_template_by_file(string $template_file): ?array
{
global $wp_gutenberg_templates;
if (empty($wp_gutenberg_templates)) {
return null;
}
foreach ($wp_gutenberg_templates as $post_type => $templates) {
foreach ($templates as $template => $args) {
if ($args['template_file'] === $template_file) {
Expand Down

0 comments on commit ef4a278

Please sign in to comment.