[OK]を、私が見つけた私は通常、(運ではなく、何らかの理由でこの時間)書き換えを行うよう自分でそれをやろうとした後、この答え:まだカスタムポストタイプ年アーカイブ書き換えルールを生成するには?
Custom post type yearly/ monthly archive
しかし、はしていません私のために働く。私はルールをログインした場合 することは、私は正しいものを見つけることができ、それが正しく書き込まれます:
["it/press-release/([0-9]{4})/?$"]=> string(50) "index.php?post_type=press_article&year=$matches[1]"
ただ、完全を期すために、最初の行は、ルールが(それは正しいです、下の最後の1を参照)ですloggin:
array(309) {
["it/press-release/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$"]=>
string(87) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$"]=>
string(104) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$"]=>
string(104) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/([0-9]{1,})/?$"]=>
string(105) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/?$"]=>
string(71) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$"]=>
string(88) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$"]=>
string(88) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]"
["it/press-release/([0-9]{4})/([0-9]{1,2})/page/([0-9]{1,})/?$"]=>
string(89) "index.php?post_type=press_article&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]"
["it/press-release/([0-9]{4})/?$"]=>
string(50) "index.php?post_type=press_article&year=$matches[1]"
しかし、それでも動作しません。 it/press-release/2016
に移動しようとすると(その日の投稿があります)、フロントページにリダイレクトされます。
私は物事のカップルを言わなければならない:
- 私はpolylang
を使用して私のカスタムポストタイプは、次のように登録されている:
$args = array( 'public' => true, 'supports' => array('title','editor','page-attributes'), 'description' => 'Rassegna stampa', 'labels' => $labels, // omitting here since not relevant 'rewrite' => array('slug' => pll__('rassegna-stampa')), 'has_archive' => true, 'menu_icon' => 'dashicons-media-document' );//end args register_post_type('press_article',$args);
誰かが問題を見つけることができますか?
はい、私の主な問題は、ワードプレスが正しいテンプレートにリダイレクトしていないことです。 – Stratboy
"template_include"フックを使用して、使用するテンプレートを決定することができます。 (https://codex.wordpress.org/Plugin_API/Filter_Reference/template_include) – taunoha
はい私はすでに試しましたが、不思議なことに、フックが実行される前にリダイレクトが行われています。言い換えれば、いくつかのリダイレクトが起こっています(> site_url> front_page with language)。もちろん、フックは最後のもの(home/lang、press_articleではなく)でのみ実行されます。したがって、間違ったurl/redirection、正しい振る舞いはテンプレートが決定されなければならない最後のリダイレクトにあるためです。だから私の本当の問題は間違ったリダイレクションで、テンプレートではなく、申し訳ありません。テンプレートの前に何か起こるので、間違ったテンプレートにもつながります。 – Stratboy