0

It seems to me that the XML-RPC API command wp.setOptions is not working. For example if I send this information:

array(
    "users_can_register" => array(
        "desc" => "Allow new users to sign upppp",
        "readonly" => false,
        "value" => 0
    )
)

It will set the option to this value:

array(
    "users_can_register" => array(
        "desc" => "Allow new users to sign up",
        "readonly" => false,
        "value" => "1"
    )
)

Similarly, whatever value I try to set to thumbnail_size_w, the value is always 1 instead of 150 or whatever I tell it to be.

You can view the generated XML-RPC for a request where I try to change the value of users_can_register here:

<methodCall>
 <methodName>wp.setOptions</methodName>
 <params>
  <param>
   <value>
    <i4>1</i4>
   </value>
  </param>
  <param>
   <value>
    <string>username</string>
   </value>
  </param>
  <param>
   <value>
    <string>password</string>
   </value>
  </param>
  <param>
   <value>
    <struct>
     <member>
      <name>users_can_register</name>
      <value>
       <struct>
        <member>
         <name>desc</name>
         <value>
          <string>Allow new users to sign up</string>
         </value>
        </member>
        <member>
         <name>readonly</name>
         <value>
          <boolean>0</boolean>
         </value>
        </member>
        <member>
         <name>value</name>
         <value>
          <i4>0</i4>
         </value>
        </member>
       </struct>
      </value>
     </member>
    </struct>
   </value>
  </param>
 </params>
</methodCall>

. Note that I've tried different data types for value, not just the ones in this sample request.

2

I think you may be confusing the send and response data formats.

(The format you are specifying to send with is the response format.)

You probably need to just send the value as:

array("users_can_register" => "1");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy