WP Admin default view mode for Custom Post Type

To change the mode URL variable but in the load try this: add_action( ‘load-edit.php’, ‘my_default_posts_list_mode’ ); function my_default_posts_list_mode() { $post_type = isset( $_GET[‘post_type’] ) ? $_GET[‘post_type’] : ”; if ( $post_type && $post_type == ‘my_post_type’ && !isset( $_REQUEST[‘mode’] ) ) $_REQUEST[‘mode’] = ‘excerpt’; } Got the “insipration” from here: Set Default Listing “View” in Admin

Hide custom post type from nav menu manager

// set up the arguements for post type $labels = array(….); $args = array( ‘labels’ => $labels, ‘public’ => true, // display on menu and site ‘publicly_queryable’ => false, ‘show_ui’ => true, ‘query_var’ => false, ‘rewrite’ => false, ‘capability_type’ => ‘post’, ‘hierarchical’ => false, ‘menu_position’ => 111, ‘supports’ => array( ‘title’ ) ); // register … Read more

Order users by number of posts

You are using wrong approach You are using the wrong approach for what you are trying to achieve. You are using the same arguments for both WP_Query and WP_User_Query (get_users eventually translates to WP_User_Query). The problem is that WP_Query doesn’t support orderby parameter post_count as one post is always equal to one post and WP_User_Query … Read more

Counting Posts of a Given Post Type Having a Specific Taxonomy?

Somatic had the cleanest answer, but missed one thing. You should specify the numberposts to be -1 so that it counts them all. Like this: $args = array( ‘post_type’ => ‘artwork’, ‘post_status’ => ‘published’, ‘genre’ => ‘romantic’, ‘numberposts’ => -1 ); $num = count( get_posts( $args ) ); just replace genere with your taxonomy slug … Read more