WordPress hide post from custom post-type on a single page

Instead of using the pre_get_posts hook simply modify your WP_Query to fetch posts with certain conditions. $loop = new WP_Query( array( ‘post_type’ => ‘projects’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 1, ‘meta_query’ => array( array( ‘key’ => ‘your_field_name’, ‘value’ => ‘the_value’ ), ), ) ); This, right from the beginning only fetches the posts that matches … Read more

Custom date column in user table not sorting correcting

You have to add following code after your code to get the dates sorting correctly. It’s working correctly for me. Hope it will help. function change_user_order( $args ){ if( isset( $args[‘orderby’] ) ) { $args[‘meta_key’] = $args[‘orderby’]; } return $args; } add_filter( ‘users_list_table_query_args’, ‘change_user_order’ );