Making WordPress.org

Opened 2 years ago

Closed 16 months ago

#6049 closed defect (bug) (fixed)

wordpress.org/themes/twentytwenty incorrectly shows Template: Cover

Reported by: bobbingwide's profile bobbingwide Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Theme Directory Keywords: needs-patch
Cc:

Description

Marius Jensen said

I see why it happens, if that helps?

If you wouldn't mind, creating a meta ticket is the best solution, as it's the style.css parser picking up the table of contents section with a. Template: Cover Template , and parsing it as Template: cover

Change History (18)

#1 @Otto42
2 years ago

  • Owner set to Otto42
  • Status changed from new to accepted

I'll work on correcting the org database. It will take time for the caches to clear.

Last edited 2 years ago by Otto42 (previous) (diff)

#2 @Otto42
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

Corrected entry in database. Cache refresh will take some time, so it may show up again before it goes away fully in a day or two.

#3 @Otto42
2 years ago

  • Keywords needs-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening. This isn't seemingly a problem with core anymore, because they switched from using the now deprecated get_theme_data function to using the WP_Theme class exclusively.

We have a copied/modified version of this class in the theme-directory plugin, so should probably consider modifying this to also use the WP_Theme class where possible, to ensure future compatibility with core changes.

Version 1, edited 2 years ago by Otto42 (previous) (next) (diff)

#4 @desrosj
2 years ago

#6057 was marked as a duplicate.

#5 @Otto42
2 years ago

Yes, the cache is being persistently annoying here. But it is fixed in the database, confirmed, and it will go away eventually. Promise. I'm also looking at better ways of kicking this cache in particular.

In the meantime, if we upload a new version of 2020 then this will recur, but at least we know why now, and can work around it. A fix will need some minor changes to the theme directory code.

#6 @dd32
2 years ago

I've cleared the memcache & WP caches, they would've lasted for between 7-31 days otherwise.

(It no longer shows Cover as it's parent now)

Last edited 2 years ago by dd32 (previous) (diff)

#7 @bobbingwide
2 years ago

New version of 2020 was uploaded for WordPress 6.0 so the problem's recurred.

This ticket was mentioned in Slack in #meta by bobbingwide. View the logs.


2 years ago

#9 @dd32
2 years ago

reset and caches cleared.

wp>
$p = get_post( 25021 );
$p->post_parent = 0;
wp_update_post( $p );

#10 follow-up: @desrosj
20 months ago

It looks like this is happening again after the update accompanying WP 6.1.

Is it realistic to expect this to be resolved short term? If not, I'm going to add this to the release checklist to follow up with the Meta team when Twenty Twenty is updated because we (I) forgot to check for this issue this time around.

Alternatively, could we add some type of check on a cron that automatically corrects the problem until the root cause can be addressed?

This ticket was mentioned in Slack in #meta by desrosj. View the logs.


20 months ago

#12 in reply to: ↑ 10 @Otto42
20 months ago

Replying to desrosj:

It looks like this is happening again after the update accompanying WP 6.1.

Is it realistic to expect this to be resolved short term? If not, I'm going to add this to the release checklist to follow up with the Meta team when Twenty Twenty is updated because we (I) forgot to check for this issue this time around.

Alternatively, could we add some type of check on a cron that automatically corrects the problem until the root cause can be addressed?

The root cause is that you have the words "Template: Cover" in the comments of style.css.

Want to fix the problem for sure? Don't have that there in the theme.

#13 follow-up: @desrosj
20 months ago

Is there any way to make the parsing behind this more selective?

Happy to update the theme to reword these comments. But with block templates now being a staple of the editor, it's likely that more themes will potentially start to have Template: template name in their CSS files.

#14 in reply to: ↑ 13 @Otto42
20 months ago

Replying to desrosj:

Is there any way to make the parsing behind this more selective?

Yes, as I said above:

We have a copied/modified version of this function in the theme-directory plugin, so should probably consider modifying this to also use the WP_Theme class where possible, to ensure future compatibility with core changes

In the meantime, changing the style.css file is the easiest way to prevent it from happening again.

#15 @Otto42
20 months ago

  • Owner Otto42 deleted
  • Status changed from reopened to assigned

#16 follow-up: @dd32
16 months ago

  • Owner set to dd32
  • Status changed from assigned to accepted

I've corrected this again, and have a work-in-process to migrate it to WP_Theme.

#17 in reply to: ↑ 16 @dd32
16 months ago

Replying to dd32:

work-in-process to migrate it to WP_Theme.

Ultimately I decided this was too much work, too ugly and too likely to break. WP_Theme is NOT designed for being used outside of having all the files on disk, so instead I'm just going to convert it to using the same style.css parser function as WP_Theme uses.

#18 @dd32
16 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 12521:

Theme Directory: Parse style.css files using the same parsing functions as WP_Theme uses to avoid picking up stray Template: headers past the first 8KB of CSS.

Fixes #6049.

Note: See TracTickets for help on using tickets.