We have got two custom post types, both with revisions enabled.
The second custom post type has a meta box with revision
set to true
and a field of type post
which lets us select a single post of the first custom post type.
After making changes to the actual value of this post
field (= selecting a post and saving, so that there are multiple revisions), trying to display the revisions in the WordPress admin panel leads to an error in the main Meta Box plugin code.
Full error output:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in [...]/wp-content/plugins/meta-box/inc/fields/post.php:108
Stack trace:
#0 [...]/wp-content/plugins/meta-box/inc/field.php(533): RWMB_Post_Field::query()
#1 [...]/wp-content/plugins/mb-revision/revision.php(175): RWMB_Field::call()
#2 [...]/wp-content/plugins/mb-revision/revision.php(133): MB_Revision->transform_object_value_to_label()
#3 [...]/wp-includes/class-wp-hook.php(310): MB_Revision->get_field_value_for_comparison()
#4 [...]/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#5 [...]/wp-admin/includes/revision.php(91): apply_filters()
#6 [...]/wp-admin/includes/ajax-actions.php(3527): wp_get_revision_ui_diff()
#7 [...]/wp-includes/class-wp-hook.php(308): wp_ajax_get_revision_diffs()
#8 [...]/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#9 [...]/wp-includes/plugin.php(517): WP_Hook->do_action()
#10 [...]/wp-admin/admin-ajax.php(188): do_action()
#11 {main}
thrown in [...]/wp-content/plugins/meta-box/inc/fields/post.php on line 108
The PHP version is 8.1.