[wp-trac] [WordPress Trac] #56718: register_post_meta not being initialized default value right away
WordPress Trac
noreply at wordpress.org
Mon Oct 3 23:31:46 UTC 2022
#56718: register_post_meta not being initialized default value right away
--------------------------------+------------------------------
Reporter: kaimaniiii | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 5.5
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------------+------------------------------
Comment (by kaimaniiii):
Replying to [comment:1 spacedmonkey]:
> Thanks for your ticket @kaimaniiii.
>
> However, I think the issue here is a very simply one.
>
> Consider this line.
> {{{#!php
> add_action( 'rest_api_init',
'autoload_register_meta_post_core_feature_image', 9999 );
> }}}
>
> This only registers the meta on the rest api init. If you try to load
meta in another context like on the front end or in a rss, this meta would
be registered. If you can it to simple be the following, it should fix the
issue.
>
> {{{#!php
> add_action( 'init', 'autoload_register_meta_post_core_feature_image',
9999 );
> }}}
>
> I will await your response, but otherwise I believe there is no issue
here.
Oh wow! You are right! It seems like I didn't use the correct hook name!
Another question! How come is that the default value is returning as
"true", but when I am toggling off and back on again, then I get the value
"1" instead?
Is there some sort of way I can make it always return "true" instead of
"1"?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56718#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list