wordpress 3.8.1 category page 2 error 404 not found / custom post type

前端 未结 3 1443
深忆病人
深忆病人 2021-01-14 12:06

first the problem, then the tries.

Problem

The problem is that i get a 404 NOT FOUND error if i visit another page than the first category page. On the cat

3条回答
  •  轮回少年
    2021-01-14 12:46

    Try change the pre_get_posts filter.

    function namespace_add_custom_types( $query ) {
      if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
        $query->set( 'post_type', array(
                  'post', 'property'
                ));
        return $query;
       }
    }
    add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
    

    Found this at http://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/

提交回复
热议问题