How to display categories of my Custom Post Type?

Remove your code from portfolio-type.php that registers post type and taxonomy (line 9 onwards). Use the following code (in portfolio-type.php) to register the post type “portfolio” function portfolio_register() { $labels = array( ‘name’ => _x(‘Portfolio’, ‘post type general name’), ‘singular_name’ => _x(‘Portfolio Item’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘portfolio item’), ‘add_new_item’ => … Read more

Remove the “View” Link in Post Admin

add_filter( ‘post_row_actions’, ‘remove_row_actions’, 10, 1 ); function remove_row_actions( $actions ) { if( get_post_type() === ‘my_cpt’ ) unset( $actions[‘view’] ); return $actions; } Should see you through 🙂 The $actions array consists of the following: $actions[‘edit’] $actions[‘inline hide-if-no-js’] $actions[‘trash’] $actions[‘view’] To modify users grid view ‘user_row_actions‘ filter can be used. For future reference.

How to rename default posts-type Posts

I used the following script to rename the default post type: function change_post_menu_label() { global $menu, $submenu; $menu[5][0] = ‘Portfolio’; $submenu[‘edit.php’][5][0] = ‘Portfolio’; $submenu[‘edit.php’][10][0] = ‘New Portfolio’; $submenu[‘edit.php’][16][0] = ‘Portfolio Tags’; echo ”; } add_action( ‘admin_menu’, ‘change_post_menu_label’ ); function change_post_object_label() { global $wp_post_types; $labels = &$wp_post_types[‘post’]->labels; $labels->name=”Portfolio”; $labels->singular_name=”Portfolio”; $labels->add_new = ‘New Portfolio’; $labels->add_new_item = ‘New … Read more

WordPress dashboard, viewing CPT results in 504

The CPT and taxonomy terms are created via plugin. I was able to lessen the query by adding the following to my plugin: add_action( ‘pre_get_posts’, ‘nwtd_lpfs_custom_admin_query’ ); function nwtd_lpfs_custom_admin_query( $query ) { if( !is_admin() && !$query->is_main_query() ) { return; } if( is_post_type_archive( ‘services’ ) ) { $query->set(‘no_found_rows’, 1 ); $query->set(‘update_post_meta_cache’, 0 ); $query->set(‘update_post_term_cache’, 0 ); … Read more