[wp-trac] [WordPress Trac] #55600: Can't save registered post meta field of type string that equals registered default value via REST API

WordPress Trac noreply at wordpress.org
Tue Jun 11 08:53:07 UTC 2024


#55600: Can't save registered post meta field of type string that equals registered
default value via REST API
--------------------------------+------------------------------
 Reporter:  kraftner            |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:  rest-api
--------------------------------+------------------------------

Comment (by ramon fincken):

 I try to reproduce this but I fail.

 vanilla WP, twentyeleven -> post (gutenberg)

 {{{#!php
 <?php
 register_post_meta(
   '', // all
   'my_metastring',
   [
     'show_in_rest' => true,
     'single' => true,
     'type' => 'string',
     'default' => 'foo'
   ]
 );

 register_post_meta(
   '', // all
   'my_metabool',
   [
     'show_in_rest' => true,
     'single' => true,
     'type' => 'boolean',
     'default' => true
   ]
 );
 }}}

 and
 {{{#!php
 <?php
 register_post_meta(
   'post',
   'my_metastring',
   [
     'show_in_rest' => true,
     'single' => true,
     'type' => 'string',
     'default' => 'foo'
   ]
 );

 register_post_meta(
   'post',
   'my_metabool',
   [
     'show_in_rest' => true,
     'single' => true,
     'type' => 'boolean',
     'default' => true
   ]
 );
 }}}

 nothing is stored on create new post, and nothing is stored in update
 post.
 I am looking in the postmeta table.

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


More information about the wp-trac mailing list