wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
665 stars 143 forks source link

Handle post_type not being an array #824

Closed srtfisher closed 3 months ago

srtfisher commented 2 years ago

Ensure that $post_types is an array to prevent a fatal PHP (the fatal error applies to PHP 8):

Fatal error: Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, string given
in ...

Call stack:

Shortcode_UI_Field_Post_Select::action_wp_ajax_shortcode_ui_post_field()
wp-includes/class-wp-hook.php:307
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:331
WP_Hook::do_action()
wp-includes/plugin.php:476
do_action()
wp-admin/admin-ajax.php:187
Query Monitor
There has been a critical error on this website.
srtfisher commented 10 months ago

@goldenapples yes, it also handles a bug for PHP 8.2.