How i add new link after Edit | Quick Edit | Trash | View in quick edit section

You can do it by creating a hook for post_row_actions filter. If your CPT is hierarchical post type use page_row_actions filter. add_filter( ‘post_row_actions’, ‘wpse8170_row_actions’, 10, 2 ); function wpse8170_row_actions( $actions, WP_Post $post ) { if ( $post->post_type != ‘my-custom-post-type’ ) { return $actions; } $actions[‘wpse8170-pdf’] = ‘<a href=”http://your/url/here”>PDF</a>’; return $actions; }

How to show custom post type count in the users admin page

There are 2 pretty undocumented hooks ‘manage_users_custom_column’ and ‘manage_users_columns’ that you can use for the scope. They works in same manner of ‘manage_posts_custom_column’ and ‘manage_posts_columns’ that are better documented, see Codex. So you can do something like this: /* * Add Event Column */ function users_events_column( $cols ) { $cols[‘user_events’] = ‘Events’; return $cols; } … Read more

Custom Post Type rewrite redirects to homepage

The most important args for rewrite redirects when registering new post type are: ‘public’ => true, ‘publicly_queryable’ => true, ‘query_var’ => true, I have pasted some code below which I have tested and it working fine for the url : www.example.com/people/john $labels_employee = array(‘name’ => _x( ‘Employees’, ‘Post typegeneral name’, ‘textdomain’ ),’singular_name’ => _x( ‘Employee’, … Read more

Is there possible way to modify custom post type?

You can change register_post_type() arguments before the new type is created. To do this, use the register_post_type_args filter. add_filter( ‘register_post_type_args’, ‘se342540_change_post_type_args’, 10, 2 ); function se342540_change_post_type_args( $args, $post_name ) { if ( $post_name != ‘cpt_slug’ ) return $args; $args[‘has_archive’] = true; // // other arguments return $args; }

Get only parent terms from wp_get_post_terms

wp_get_post_terms doesn’t accept ‘parent’ or ‘hide_empty’ parameters in it’s arguments array, only ‘orderby’,’order’ and ‘fields’ but you are on the right track, simply add a conditional check before you echo out the slug: function project_get_item_classes($post_id = null) { if ($post_id === null) return; $_terms = wp_get_post_terms($post_id, ‘construction_type’); foreach ($_terms as $_term) { if ($_term->parent == … Read more

Get count of custom post type created by current user

I’m posting a new answer because I found this thread while searching for the same thing and the solutions here weren’t optimal. The post_type argument can be a string or an array of post types. function custom_count_posts_by_author($user_id, $post_type = array(‘post’, ‘page’, ‘custom_post_type’)) { $args = array( ‘post_type’ => $post_type, ‘author’ => $user_id, ‘post_status’ => ‘publish’, … Read more