サポート » 使い方全般 » カスタム投稿月別アーカイブのリンク先404エラーについて

  • お世話になってます。
    この数日、カスタム投稿の月別アーカイブのリンク先が404エラーになってしまう事にハマってます。
    色んなサイトを見て参考にしても解決できないので、皆様のお力添えをお願いしたいです。
    よろしくお願い致します。
    デフォルトのサイドバー1を使用しカスタム投稿songlistの月別アーカイブのウィジェットを使用しています。

    2016年1月(1)
    2016年2月(4)

    など、投稿件数も表示されるのですが、リンク先が404エラーになります。
    個別記事のURLは、
    http://www.(サイトアドレス)/songlist/2016/02/04/(投稿タイトル)/
    2016年2月を押した先の404エラーのURLは、
    http://www.(サイトアドレス)/songlist/2016/02/
    となっています。
    サイドバー1を使わず、sidebar.phpに直打ちする事も試しましたが、
    http://www.(サイトアドレス)/songlist/date/2016/02/
    となり、同じく404エラーでした。
    パーマリンク設定:月と投稿名
    songlist http://www.(サイトアドレス)/songlist//%year%/%monthnum%/%day%/%postname%/

    使用テーマ:bones
    カスタム投稿:function.phpに記述
    使用プラグイン:Custom Post Type Permalinks Vr1.4

    function custom_post_example() {
    	register_post_type( 'songlist',
    		array( 'labels' => array(
    			'name' => __( 'Songlist', 'bonestheme' ),
    			'singular_name' => __( 'Custom Post', 'bonestheme' ),
    			'all_items' => __( 'Song一覧', 'bonestheme' ),
    			'add_new' => __( '新曲', 'bonestheme' ),
    			'add_new_item' => __( 'Add New Custom Type', 'bonestheme' ),
    			'edit' => __( 'Edit', 'bonestheme' ),
    			'edit_item' => __( 'Edit Post Types', 'bonestheme' ),
    			'new_item' => __( 'New Post Type', 'bonestheme' ),
    			'view_item' => __( 'View Post Type', 'bonestheme' ),
    			'search_items' => __( 'Search Post Type', 'bonestheme' ),
    			'not_found' =>  __( 'Nothing found in the Database.', 'bonestheme' ),
    			'not_found_in_trash' => __( 'Nothing found in Trash', 'bonestheme' ),
    			'parent_item_colon' => ''
    			), /* end of arrays */
    			'description' => __( 'This is the example custom post type', 'bonestheme' ),
    			'public' => true,
    			'publicly_queryable' => true,
    			'exclude_from_search' => false,
    			'show_ui' => true,
    			'query_var' => true,
    			'menu_position' => 8,
    			'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png',
    			'rewrite'	=> array( 'slug' => 'songlist', 'with_front' => false ),
    			'has_archive' => true,
    			'capability_type' => 'post',
    			'hierarchical' => false,
    			'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', 'revisions', 'sticky')
    		)
    	);

    archive-songlist.php

    <h1 class="archive-title"><?php post_type_archive_title(); ?></h1>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?>>
    
    <header class="article-header">
    
    <h3 class="h2">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
    </a>
    </h3>
    <p class="date"><?php the_time( 'Y-m-d' ) ?></p>
    
    </header>
    </article>
    
    <?php endwhile; ?>
    <?php bones_page_navi(); ?>
    <?php else : ?>
    <?php endif; ?>

3件の返信を表示中 - 1 - 3件目 (全3件中)
  • 基本設定のパーマリンクの方はどうなっていますか?
    また、カスタム投稿の設定を変更するとパーマリンクが変更されますが、その際、WordPressがキャッシュをしているため、すぐには反映されず挙動がおかしくなる場合があります。

    その際は、パーマリンクの設定ページで、[変更を保存]をたたいてみてください。

    トピック投稿者 eriyauechi

    (@eriyauechi)

    Toro様
    返信ありがとうございます。
    すみません、基本設定のパーマリンクとは、パーマリンク設定の上部の、共通設定の事でしょうか?
    もしそうであれば、共通設定は月と投稿名になっています。

    時間置いて変更と保存を何回も試しましたが変わりませんでした。
    そこまで複雑な事ではないような気もしますが、未だ解決できていません。。

    そこですね。

    ちょっとこちらでは再現出来ないので、なんともです。

    flush_rewrite_rules をプラグインや、functions.php に記述してるとリライト周りはバグるので、その場合は、その記述を削除してみてください。

    参考: 関数リファレンス/flush rewrite rules – WordPress Codex 日本語版

3件の返信を表示中 - 1 - 3件目 (全3件中)
  • トピック「カスタム投稿月別アーカイブのリンク先404エラーについて」には新たに返信することはできません。