Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0.57 KB | None |
- function my_cptui_add_post_types_to_archives( $query ) {
- // We do not want unintended consequences.
- if ( is_admin() || ! $query->is_main_query() ) {
- return;
- }
- if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
- // Replace these slugs with the post types you want to include.
- $cptui_post_types = array( 'your_Blog', 'your_blog' );
- $query->set(
- 'post_type',
- array_merge(
- array( 'post' ),
- $cptui_post_types
- )
- );
- }
- }
- add_filter( 'pre_get_posts', 'my_cptui_add_post_types_to_archives' );
Advertisement
Comments
-
- Paste this function the the functions.php page, save and refresh. This will allow wordpress to give your other blogs the ablity to be sorted by category for your CPT UI plugin wordpress.
Add Comment
Please, Sign In to add comment