Just updated another Wordpress site from PHP 7.4 to 8.1 and needed to update the deprecated create_function. Here's the old code:
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return '.$sp_products_per_page.';' ), 20 );
I updated it to:
add_filter( 'loop_shop_per_page', function($cols) { return $sp_products_per_page; }, 20);
But it still doesn't seem to be working correctly. Is this syntax correct?