• Resolved flmnhomtwp

    (@flmnhomtwp)


    Hello! We recently upgraded from PHP 7.3 to 8.0.27, running WP 6.2. We have several sites using this plugin and they are still working fine on the public-facing side. I went to the plugin menu in the dashboard to edit something, and when I try to view the Add/Edit Post Types or Add/Edit Taxonomies pages in the dashboard I get the critical error below. (I can view the Registered Types/Taxes page okay.) Thanks for your help!

    Warning: foreach() argument must be of type array|object, bool given in /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php on line 536
    
    Fatal error: Uncaught TypeError: shuffle(): Argument #1 ($array) must be of type array, bool given in /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php:542 Stack trace: #0 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php(542): shuffle() #1 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(308): cptui_randomize_ads() #2 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters() #3 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php(483): apply_filters() #4 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php(345): cptui_get_ads() #5 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(308): cptui_products_sidebar() #6 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #7 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #8 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/post-types.php(174): do_action() #9 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(308): cptui_manage_post_types() #10 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #11 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #12 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-admin/admin.php(259): do_action() #13 {main} thrown in /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wp-content/plugins/custom-post-type-ui/inc/utility.php on line 542

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    By any chance do you have CPTUI-Extended installled and active? Seems like we’re not getting an array of “ads” like expected, and the only way I can think of that potentially being the case at the moment is if Extended was in use.

    Thread Starter flmnhomtwp

    (@flmnhomtwp)

    Nope, we do not have that plugin installed and we have never attempted to use it in the past.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hmm

    Feel free to try out this code in your functions.php file to see if that helps resolve:

    function cptui_remove_ads() {
    	remove_action( 'cptui_below_post_type_tab_menu', 'cptui_products_sidebar', 10 );
    	remove_action( 'cptui_below_taxonomy_tab_menu', 'cptui_products_sidebar', 10 );
    	add_action( 'admin_head', 'cptui_no_ad_css' );
    }
    add_action( 'init', 'cptui_remove_ads' ); 
    Thread Starter flmnhomtwp

    (@flmnhomtwp)

    Thank you! We tried it out and now see this:

    Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "cptui_no_ad_css" not found or invalid function name in /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php:308 Stack trace: #0 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #1 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #2 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-admin/admin-header.php(163): do_action() #3 /var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-admin/admin.php(239): require_once('/var/www/www-tes…’) #4 {main} thrown in?/var/www/www-test.floridamuseum.ufl.edu/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php?on line?308
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Remove the add_action( 'admin_head', 'cptui_no_ad_css' ); line. That must be coming from Extended and I forgot. Just the 2 remove actions

    Thread Starter flmnhomtwp

    (@flmnhomtwp)

    Thanks, that fixed our issue – post/taxonomy adding & editing tabs are visible again on our dashboard. Appreciate the fast support!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m still curious why/how that array value is turning up boolean, but I’m not going to fight a quick workaround by removing that spot from being run in the first place.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Dashboard plugin UI critical error with PHP 8’ is closed to new replies.