Modifying a CoBlocks Filter in Functions

apply_filters() calls all callbacks added via add_filter() for the specific filter hook, which is coblocks_post_carousel_settings in your case, so instead of:

apply_filters( 'coblocks_post_carousel_settings', 'my_filter_coblocks_carousel' );

You should actually do:

// You should use add_filter() and not apply_filters().
add_filter( 'coblocks_post_carousel_settings', 'my_filter_coblocks_carousel' );

And, your callback should accept the slider settings passed by the plugin to apply_filters() — which then passes the settings (which is an array) to your callback. So define your callback like so and then just change the settings (or array items) that you wish to change:

function my_filter_coblocks_carousel( $settings ) {
    $settings['slidesToShow'] = 5;
    return $settings;
}

Please check the function reference (see links above) for more details, but basically, if you want others to filter something in your code, you use apply_filters() to let that something to be filtered by plugin or some custom code. And in your case, the (CoBlocks) plugin calls apply_filters() and you’re part of that “others”, thus you use add_filter() and not apply_filters(). I hope that makes sense? 🙂

Update: Examples for modifying the inner slidesToShow settings

So this is actually generic PHP stuff and it depends on you on how would you modify that inner slidesToShow in the responsive array items, but hopefully these help you:

// So this would all be in the my_filter_coblocks_carousel() function:

// Change the slidesToShow setting **only** for the "600" breakpoint.
foreach ( $settings['responsive'] as $i => $arr ) {
    if ( 600 === $arr['breakpoint'] ) {
        $settings['responsive'][ $i ]['settings']['slidesToShow'] = 3;
    }
}

// Add a new breakpoint.
$settings['responsive'][] = array(
    'breakpoint' => 320,
    'settings'   => array(
        'slidesToShow' => 1,
    ),
);