Skip to content

Commit

Permalink
fix: do not throw warnings on undefined post_types
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Mar 1, 2024
1 parent 574d392 commit c02ec30
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/php/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ public function appendForm()
{
global $post;

if(!is_a($post, 'WP_Post')) {
return;
}

$allowedPostTypes = apply_filters('CustomerFeedback/post_types', get_field('customer_feedback_posttypes', 'option'));
if (is_null($allowedPostTypes)) {
$allowedPostTypes = array('page');
}

if (!is_array($allowedPostTypes) || !in_array($post->post_type, $allowedPostTypes)) {
if (!is_array($allowedPostTypes) || !in_array($post->post_type ?? null, $allowedPostTypes)) {
return;
}

Expand Down

0 comments on commit c02ec30

Please sign in to comment.