• Hi,

    Please we have an issue on our website which is that we created a post type called “products” and also we created “archive-products.php”, all was good till yesterday where now the link https://www.alwadi-alakhdar.com/products/ is taking us to the page “Products” even though the “products” page was already found before and the link :https://www.alwadi-alakhdar.com/products/ was taking directly to the “archive-products.php”,

    but I don’t know what happens, I tried activating another theme and then activating the current theme but the issue is still appearing.

    Here is the code for custom post type:
    function create_post_type() {
    $prod_lb = “All Products”;
    if( ICL_LANGUAGE_CODE == ‘fr’ ){
    $prod_lb = “Tous Les Produits”;
    }
    register_post_type( ‘products’,
    array(
    ‘labels’ => array(
    ‘name’ => $prod_lb,
    ‘singular_name’ => ‘Product’ ,
    ‘menu_name’ => ‘Products’,
    ‘singular_name’ => ‘Product’,
    ‘all_items’ => $prod_lb,
    ‘add_new_item’ => ‘Add New Product’,
    ‘search_items’ => ‘Search Products’,
    ‘not_found’ => ‘No products found’,
    ‘not_found_in_trash’ => ‘No products found in Trash’,
    ‘edit_item’ => ‘Edit Product’,
    ‘new_item’ => ‘New Product’,
    ‘view_item’ => ‘View Product’
    ),
    ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘revisions’ , ‘thumbnail’ ,’page-attributes’,’tags’),
    ‘menu_position’ => 5,
    ‘public’ => true,
    ‘has_archive’ => true,
    ‘show_in_nav_menus’ => TRUE,
    ‘rewrite’ => array(‘slug’ => ‘products/%product_categories%’,’with_front’ => FALSE),
    ‘taxonomies’ => array( ‘product_categories’,’post_tag’),
    ‘capability_type’ => ‘post’
    //’rewrite’ => false
    )
    );
    //flush_rewrite_rules();
    }

    Any advices please? ITS URGENT!

    Thank you in advance,

Viewing 1 replies (of 1 total)
  • I have not checked your code, but there are two likely issues with this topic (assuming the code is correct).

    1. Your custom post type slug is the same as a page slug.
    2. After adding your Custom Post type, you have not forced an update (overwrite same) Permalink setting.

    Please check each.

    • This reply was modified 7 years, 10 months ago by Pioneer Web Design. Reason: Last post took e away this one added an e, nice trick
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type opening page not archive’ is closed to new replies.