How to get a custom post type archive paged when using a custom field for post sorting?

You shouldn’t be using a custom query for a post type archive page. Pagination being difficult is one of the reasons. If you want to change your post type archive to sort by a custom field, hook into pre_get_posts to modify the main query: function wpse_282839_post_type_order( $query ) { if ( ! is_admin() && $query->is_post_type_archive( … Read more

Not able to get all the actions (View, Edit, Quick Edit, Trash), and not able to delete post in custom post type

After some online searching I found a key to add in my arguments array of custom post type, map_meta_cap => true this brings the View, Edit, Quick Edit, Trash and that resolved my post delete issue also. I would like to recommend the following documentation who ever get stuck in such situation 🙂 https://codex.wordpress.org/Function_Reference/register_post_type

Overriding a CPT template file through functions.php

Your template_override() function isn’t returning anything if your conditions aren’t met, which will break everything that doesn’t meet your conditions. You need to pass the existing template through: function wpse_283378_template_override( $template ) { // My conditions. return $template; } add_filter(‘template_include’, ‘wpse_283378_template_override’); Also, is_post_type() and template_override() are very generic names for functions, which increases the risk … Read more