How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”

I found a way to get it done but I am not very happy with this procedure. Please add your answer if you find better way. Mean while, this might be of help. add_action(‘admin_head-edit.php’,’addCustomImportButton’)); I only need this on edit page, so I am using admin_head-edit.php action, but you can use admin_head or some other … Read more

Search tags in CPTs

This would only work if the keyword exactly matches the tag that you are searching for, and unfortunately, tag data isn’t indexed by WordPress search by default, so that won’t yield anything either. If you want to index the tags and include that in search results you might want to use a plugin. Relevanassi might … Read more

How can I add a column in the wp_list_table of the admin area?

I think what you need is the set of filters and actions to add custom columns to post edit screens: manage_edit-post_type_columns: used to add columns manage_posts_custom_column: used to print the content of each row of the column manage_edit-post_type_sortable_columns: used to register sortable columns. Undocumented. request: you may need to use this filter in combination with … Read more

Pagination not working

As I already stated in comments, you should never use query_posts, only use query_posts if you are intended to break your page functionalities. Add query_posts to the very top of your EVIL LIST. query_posts breaks the main query object, the very object that your pagination function relies on. Your pagination function relies on the $max_num_pages … Read more

Comment Email Notification for CPT Comments

I have figured it out. There were a bunch of issues with the existing code. The code wasn’t getting $author_email appropriately which was causing it to fail and causing wp_mail() not to fire. add_action(‘comment_post’, ‘comment_email_notification’, 11, 2); function comment_email_notification($comment_ID, $comment_approved) { $post_type = get_post_type(); if ($post_type !== ‘jobs’) { return; } $comment = get_comment($comment_ID); $post_ID … Read more

Prevent author role from editing all posts in custom post type?

You should declare your desired capabilities when you are registering the post type. Justin’s article here is a good one for custom post types: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress When you are registering your custom post type, you can set this to be standard capabilities for posts, eg: ‘capability_type’ => ‘post’, or to be standard capabilities for pages, eg. … Read more