WordPress admin-ajax.php 400 Failed to load

Solution:

I think the way you are getting your ajax URL here : https://gist.github.com/chadamski/410f9deb4c9d7bfe51beef5720c5991d#file-ajaxcptfilter-txt-L42 is wrong.

Use on of the two options.

Option 1

In your header add this:

<script type="text/javascript">
    var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
</script>

Now use this ajaxurl in your ajax request.

Option 2

Use script localization.

wp_localize_script( 'FrontEndAjax', 'ajax', array(
    'url' => admin_url( 'admin-ajax.php' )
) );

Here FrontEndAJAX has to be replaced with name of your js file where the ajax code is written.

If set correctly, you can get your url as : ajax.url

Fix action

I am not sure if you are running this on the frontend or just the admin area. If its on the frontend you need to add this.

add_action( 'wp_ajax_load-all-filter', 'prefix_load_all_cat_posts' );
add_action( 'wp_ajax_nopriv_load-all-filter', 'prefix_load_all_cat_posts' );

here : https://gist.github.com/chadamski/410f9deb4c9d7bfe51beef5720c5991d#file-ajaxcptfilter-txt-L117