Wordpress 即使在$page之后,自定义文章类型的分页也将变为404

Wordpress 即使在$page之后,自定义文章类型的分页也将变为404,wordpress,post,types,pagination,Wordpress,Post,Types,Pagination,救命啊!我疯了 我有一个页面,其中显示了我需要分页的自定义帖子类型“rm”,但当我点击第2页时,即使我使用了 <?php $paged = ( get_query_var('page') ) ? get_query_var('page') : 1; ?> 我在互联网上搜寻解决方案,但什么也找不到。有人知道哪里出了问题吗 这是我的自定义邮件类型注册- <?php /* RM SHOWCASE CREATION */ add_action('init', 'rm_regist

救命啊!我疯了

我有一个页面,其中显示了我需要分页的自定义帖子类型“rm”,但当我点击第2页时,即使我使用了

<?php $paged = ( get_query_var('page') ) ? get_query_var('page') : 1; ?>

我在互联网上搜寻解决方案,但什么也找不到。有人知道哪里出了问题吗

这是我的自定义邮件类型注册-

<?php /* RM SHOWCASE CREATION */
add_action('init', 'rm_register');

function rm_register() {

$labels = array(
    'name' => _x('Rich media', 'post type general name'),
    'singular_name' => _x('Creative', 'post type singular name'),
    'add_new' => _x('Add New', 'Creative item'),
    'add_new_item' => __('Add New Creative'),
    'edit_item' => __('Edit Creative'),
    'new_item' => __('New Creative'),
    'view_item' => __('View Creative'),
    'search_items' => __('Search Creative'),
    'not_found' =>  __('Nothing found'),
    'not_found_in_trash' => __('Nothing found in Trash'),
    'parent_item_colon' => '',
);

$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'rich-media-showcase'),
    'capability_type' => 'post',
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','editor','thumbnail'),
    'taxonomies' => array( 'verticals','features','device'),
    'has_archive' => false
  );

register_post_type( 'rm' , $args );

这是我的疑问

<?php do_action('show_beautiful_filters', 'rm'); ?>
<?php // set up or arguments for our custom query
    $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
    $query_args = array(
       'post_type' => 'rm',
       'paged' => $paged,
    );
// create a new instance of WP_Query
$the_query = new WP_Query( $query_args ); ?>

<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>
<a class="creativeURL" href="<?php the_field('creative_url'); ?>" target="_blank" >
    <article class="creative">
        <img class="creativeImg" src="<?php the_field('cover_photo'); ?>" alt="<?php the_title(); ?>"/>
        <h1><?php the_title(); ?></h1>
    </article>
</a>
<?php endwhile; ?>

<?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1  ?>
   <nav class="prev-next-posts">
      <div class="prev-posts-link">
        <?php echo get_next_posts_link( 'Older Entries', $the_query->max_num_pages ); // display older posts link ?>
      </div>
      <div class="next-posts-link">
         <?php echo get_previous_posts_link( 'Newer Entries' ); // display newer posts link ?>
      </div>
   </nav>
<?php } ?>

<?php // clean up after our query
   wp_reset_postdata();  ?>
<?php else: ?>
  <article>
   <h1>Sorry...</h1>
   <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
</article>

很抱歉

谢谢
Phil

如果您使用?page=2而不是page/2,是否有效

您是否有与自定义帖子类型存档同名的页面


您是否尝试重新保存永久链接?

奇怪的是,我没有与自定义帖子类型同名的页面,但更改了模板文件名、文件中的模板管理员名和页面slug,结果成功了。谢谢