• Hi, lately I am getting a “request error” on my wordpress site, when I checked my error log, I got this error, many times.

    PHP Warning: trim() expects parameter 1 to be string, array given in /public_html/wp-includes/option.php on line 33

    Line 33 is

    30 function get_option( $option, $default = false ) {
    31 global $wpdb;
    32
    33 $option = trim( $option );
    34 if ( empty( $option ) ) {
    35 return false;
    36 }

    function get_option( $option, $default = false ) {
    global $wpdb;

    $option = trim( $option );
    if ( empty( $option ) ) {
    return false;
    }

    Can you please help me with this?

    Thank You.

    • This topic was modified 4 years, 4 months ago by qph9697.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • One of your plugins is calling get_option with an array instead of a string.
    You might be able to isolate it using the Health Check plugin in Troubleshoot mode. It will disable plugins for your user only, without affecting your visitors.
    You will have to correlate the time stamp in the error log with what plugins you have disabled or enabled.

    Thread Starter qph9697

    (@qph9697)

    @joyously Thank you for your response.

    Is it possible to identify using Query Monitor plugin? Because, I don’t know on which event is this function called, so it would be difficult to track which plugin is doing at which time.

    I installed query monitor, went to “Queries” and selected the caller function “get_option”. I got this list,
    https://ibb.co/X8HWBK1

    Also, I am getting “request error” on some internet connections, usually on cellular data’s, I don’t know the cause, if you may help me in this,
    Here is the screenshot,
    https://ibb.co/JqZ2BSP

    Well, sort of, because the option name is trimmed (causing the error) and then used in the query.
    But if you disable plugins one at a time, you will figure out which one gives the error.

    I think your “Request error” is a separate issue.

    Thread Starter qph9697

    (@qph9697)

    Hi, thank you for your response.

    But, what should I look for actually? I mean what should will change, if I caught the plugin causing this?

    How will I be able to detect the plugin?

    You would disable a plugin and see if the error happens. Keep doing that until the error does not happen. Then you know it was that last plugin.
    Or disable them all and see if the error happens. If not, enable one by one until the error happens. Then you know it was that plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘trim() expects parameter 1 to be string, array given in’ is closed to new replies.