Two problems that are likely related to AJAX

The problems turned out to have something to do with the sortable columns function I wrote before. Please see the function below.

function cpt_date_orderby( $query ) {
 $orderby = $query->get( 'orderby' );
 if( 'date' == $orderby ) {
    $query->set('meta_key', 'date');
    $query->set('orderby', 'meta_value_num');
 }
}
add_action( 'pre_get_posts', 'cpt_date_orderby' );

The problem lies in line 3 where ‘$orderby’ equaling ‘date’ is the condition. It seems ‘date’ is a reserved value that cannot be used for the condition for sorting, despite the fact that ‘date’ is a custom field I created with ACF. The solution is quite simple: Don’t use ‘date’ but something else, for example, ‘date1’.

Hope this helps those who are struggling with this problem.