admin管理员组

文章数量:1290927

The pagination links in CPT archive created with Elementor Pro get a 404.

I've spend a full day searching and trying everything I found on Google with search "CPT Elementor archive pagination 404": readjust posts per page in write settings, tweak Function.php, tweak cpt php (in my case as a custom made plugin , see herafter) and some other... none resulting in a partial or full solution.

Example of page resulting in 404 is here: / (access with admin/admin). The standard archive pagination links work perfectly (/). This is test site, same happens on proper website.

This is driving me crazy. I'm doing my best with the beginner knowledge I have. Please help.

    add_action('init', 'CT_temoignage');
    function CT_temoignage()
    {
        register_post_type('post-temoignage', array(
         'label' => __('Témoignages'),
         'singular_label' => __('Témoignage'),
         'public' => true,
         'has_archive' => true,
         'show_ui' => true,
         'capability_type' => 'post',
         'hierarchical' => false,
         'taxonomies'=> array ('category', 'post_tag'),
         'supports' => array('title', 'author', 'editor', 'thumbnail','excerpt','revisions','page-attributes','publicize', 'wpcom-markdown'),
         'menu_position'=>5,
'rewrite' => array('slug' => 'temoignages','with_front' => true),    
         // 'query_var' => 'temoignage'
          'publicly_queryable' => true,
    'query_var' => true,
    'rewrite' => false,
        ));
        add_theme_support( 'post-thumbnails' );
        global $wp_rewrite;
$gallery_structure = '/temoignages/%post-temoignage%';
$wp_rewrite->add_rewrite_tag("%post-temoignage%", '([^/]+)', "post-temoignage=");
$wp_rewrite->add_permastruct('post-temoignage', $gallery_structure, true);
    }   
// Add filter to plugin init function
add_filter('post_type_link', 'post_temoignage_permalink', 10, 3);     
?>```

本文标签: custom post typesHelp with Elementor Pagination CPT archive 404 problem