WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#32518 closed defect (bug) (invalid)

Twenty Fifteen causes random redirects to archives/robots.txt when using CPT or page templates

Reported by: Jyria Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2.2
Component: Bundled Theme Keywords: needs-testing
Focuses: Cc:

Attachments (1)

changed-php-files.zip (8.0 KB) - added by Jyria 7 years ago.
Changed/Added php files in TwentyFifteen Child directory

Download all attachments as: .zip

Change History (9)

@Jyria
7 years ago

Changed/Added php files in TwentyFifteen Child directory

#1 follow-up: @rmccue
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Hi, thanks for reporting this issue!

I'm not sure what here could be causing "random" redirects, but it sounds like it might be a plugin you have active, or potentially some of your custom code. I don't think this is a Twenty Fifteen bug, and we'd probably have heard more reports if it were happening on other sites.

I'm going to close this issue as invalid for now to handle on the support forum instead, but the ticket can always be reopened later if you can track down the issue. :)

#2 @SergeyBiryukov
7 years ago

  • Component changed from Themes to Bundled Theme
  • Summary changed from TwentyFifteen causes random redirects to archives/robots.txt when using CPT or page templates to Twenty Fifteen causes random redirects to archives/robots.txt when using CPT or page templates

#3 in reply to: ↑ 1 @Jyria
7 years ago

  • Component changed from Bundled Theme to Themes
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Summary changed from Twenty Fifteen causes random redirects to archives/robots.txt when using CPT or page templates to TwentyFifteen causes random redirects to archives/robots.txt when using CPT or page templates

Deactivation of plugins did not do anything to change the theme behaviour.
I deactivated the mod_pagespeed on my apache. Still no changes in theme behaviour.

Then I played with my custom post type a bit more.

This is what I did and now it works.. I hope ;)

I corrected a typo in functions.php: capatibilitys.... lol. Then I decided to register the CPT via Plugin rather than child theme functions.php. So I wrote a small plugin to do the job.

I deleted the CPT registration function from theme functions.php

The weird behaviour stayed the same.

I then checked the templates once more.. I played around with file naming according to WP Codex. No luck.
For example when trying to access a page with slug 'arbeiten' or also my blogpage, it would redirect me to my CPT 'termine' archive. Or also to my page template 'shop'.

I finally renamed the CPT archive back to archive-termine.php ( In the meantime while trying to find out what was wrong, I had named it termine.php )

Still no luck. Same weird behaviour.

In the end, I thought, ok.. if WP checks step by step the page/post/archive templates and then ends up using the cpt archive or my custom page template, then the reason can only be, that it simply can not "see" the page.php, archive.php etc, which are located in the parent theme folder.

So I copied the page.php and archive.php from my twentyfifteen parent theme folder to my childtheme directory as well.
That did the trick.

Is that intended?
I think not, right? WP should check in parent themefolder as well as childtheme to decide which template to choose, doesn't it?
So I believe there is something wrong with twentyfifteen.

Also the behaviour was worst in firefox. In chrome/safari on my Mac I could access the pages 85% without problems. At first I could not reproduce the behaviour because of this. Yes, I did get the behaviour in these browsers as well. However not as constantly. So I checked in firefox on my windows machine where this behaviour occurred reliably, to get this troubleshooted.

Sorry for the long post, but thank you very much for reading it all.

Last edited 7 years ago by Jyria (previous) (diff)

#4 @Jyria
7 years ago

  • Component changed from Themes to Bundled Theme
  • Keywords needs-testing added

#5 @Jyria
7 years ago

  • Summary changed from TwentyFifteen causes random redirects to archives/robots.txt when using CPT or page templates to Twenty Fifteen causes random redirects to archives/robots.txt when using CPT or page templates

#6 @Jyria
7 years ago

I just found out that this also affects the single.php

Sometimes the archive-somecptslug ist displayed in frontend instead of the single post page that I was trying to visit.

I guess it affects the entire twenty fifteen child theme template structure. Thus I also copied index.php and single.php into my twenty fifteen child theme folder, although I never even created any additional single or index pages.

#7 @netweb
7 years ago

  • Milestone set to Awaiting Review

#8 @obenland
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

I agree with @rmccue, without a reliable way to reproduce the issue the forums seem to be a more appropriate place to find a solution here.

Note: See TracTickets for help on using tickets.