[wp-trac] [WordPress Trac] #58223: twentytwenty_end_of_post_meta_list needs global $has_meta

WordPress Trac noreply at wordpress.org
Sun Apr 30 00:20:08 UTC 2023


#58223: twentytwenty_end_of_post_meta_list needs global $has_meta
---------------------------+------------------------------
 Reporter:  chiefastro     |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  template
---------------------------+------------------------------
Description changed by sabernhardt:

Old description:

> There’s a bug in the Twenty Twenty theme in twentytwenty_get_post_meta.
> The bug prevents the action hooks twentytwenty_start_of_post_meta_list
> and twentytwenty_end_of_post_meta_list from displaying additional meta
> data when the default meta data fields are not populated.
>
> The variable $has_meta must be true for any meta to be displayed. It is
> set to false initially and is only set to true if one of the default meta
> are provided. For single-bottom, if no tags are in the post, $has_meta
> will be false regardless of additional meta attempting to be displayed by
> the action hooks.
>
> I solved the bug by defining $has_meta as a global inside
> twentytwenty_get_post_meta. From there, I was able to modify it’s value
> to true within my action hook function.
>
> Hope this can be fixed in the published version of the theme so I don’t
> have to use a hacked version.
>
> I posted on the theme support page and was asked to post a bug in this
> forum instead. Link to my theme support post:
> [https://wordpress.org/support/topic/twentytwenty_end_of_post_meta_list-
> needs-global-has_meta/]

New description:

 There’s a bug in the Twenty Twenty theme in `twentytwenty_get_post_meta`.
 The bug prevents the action hooks `twentytwenty_start_of_post_meta_list`
 and `twentytwenty_end_of_post_meta_list` from displaying additional meta
 data when the default meta data fields are not populated.

 The variable `$has_meta` must be true for any meta to be displayed. It is
 set to `false` initially and is only set to `true` if one of the default
 meta are provided. For `single-bottom`, if no tags are in the post,
 `$has_meta` will be false regardless of additional meta attempting to be
 displayed by the action hooks.

 I solved the bug by defining `$has_meta` as a global inside
 `twentytwenty_get_post_meta`. From there, I was able to modify its value
 to true within my action hook function.

 Hope this can be fixed in the published version of the theme so I don’t
 have to use a hacked version.

 I posted on the theme support page and was asked to post a bug in this
 forum instead. Link to my theme support post:
 [https://wordpress.org/support/topic/twentytwenty_end_of_post_meta_list-
 needs-global-has_meta/]

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58223#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list