[wp-trac] [WordPress Trac] #41604: REST API: Attempting to create or update a non-existent setting doesn't return an error response

WordPress Trac noreply at wordpress.org
Mon Jun 16 07:34:59 UTC 2025


#41604: REST API: Attempting to create or update a non-existent setting doesn't
return an error response
--------------------------------------+--------------------------
 Reporter:  johnbillion               |       Owner:  johnbillion
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.9
Component:  Options, Meta APIs        |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:  rest-api
--------------------------------------+--------------------------

Comment (by sheldorofazeroth):

 @wildworks Due to this issue, I used $request->get_params(); but as it
 also picked the URL parameters, therefore I changed it to
 $request->get_body_params().

 I agree with your point. I think the below code can fix this:

 {{{
 $params = $request->get_params();
 $url_params = $request->get_url_params();
 $query_params = $request->get_query_params();
 $params = array_diff_key( $params, $url_params, $query_params );
 }}}

 @wildworks @johnbillion let me know what you think? I'll update my PR
 accordingly.

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


More information about the wp-trac mailing list