Change the behaviour of archive cpt category and single cpt by plugin, not by theme

You can use templates located within your plugin instead of theme files, like so: add_filter(‘archive_template’, ‘redirect_to_plugin_archive_template’); function redirect_to_plugin_archive_template($template) { if(is_post_type_archive(‘my_cpt’)) { return dirname(__FILE__) . ‘/templates/my_archive_template.php’; } } add_filter(‘single_template’, ‘redirect_to_plugin_single_template’); function redirect_to_plugin_single_template($template) { if(is_singular(‘my_cpt’)) { return dirname(__FILE__) . ‘/templates/my_single_template.php’; } } Obviously you need to change the custom post type slug and the template paths, but … Read more

Make a magic tag work with Custom Post Types

[Comment reposted as answer at request of OP author:] Rather than deleting them, why don’t you add your post_type to the if() statement: //Don’t process anything but POSTS and PAGES (i.e. no revisions) if( $data[‘post_type’] != ‘post’ && $data[‘post_type’] != ‘page’ && $data[‘post_type’] != ‘foto’ ) return $data; As that comment in the code makes … Read more