Taxonomy structure help

If you want to filter your audio lessons post archive you could borrow from the article I linked you to and add a custom rewrite rule: function wpa_add_rewrite_rules() { global $wp_rewrite; $new_rules = array( ‘audio-lessons/language/(.+)/?$’ => ‘index.php?post_type=audio-lesson&language=” . $wp_rewrite->preg_index(1) ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action( “generate_rewrite_rules’, ‘wpa_add_rewrite_rules’ ); After re-saving your permalinks, something … Read more

Archive for CPT

Custom post types are not included in the ordinary archives by default, even if registered with the taxonomies argument. You will need to add the post type to the query yourself. add_action( ‘pre_get_posts’, function($qry) { if ($qry->is_main_query() && $qry->is_category()) { $qry->set(‘post_type’,array(‘post’,’yourposttype’)); } } );

How to assign permissions for a CPT to a user

This is something you can achieve with the Advanced Custom Fields plugin. The trick is to use the ACF_LITE mode, which would let you define a dynamic list of user profile fields from functions.php. You could iterate over each post type and display a checkbox for it. Then use the edit_user_profile_update hook to call $user->add_cap(‘edit_[resource]’) … Read more