Support » Plugin: WP-Optimize - Cache, Clean, Compress. » Fatal error: Uncaught Error: Call to a member function add_logger() on boolean

  • Resolved Winston

    (@anarchoi)


    wp-optimize will break external php script that calls function wp_insert_post(). Returns fatal error.

    Fatal error: Uncaught Error: Call to a member function add_logger() on boolean in /var/www/vhosts/mydomain.com/public_html/web/app/plugins/wp-optimize/includes/class-updraft-smush-manager.php:153 Stack trace: #0 /var/www/vhosts/mydomain.com/public_html/web/wp/wp-includes/class-wp-hook.php(286): Updraft_Smush_Manager->autosmush_create_task(6416) #1 /var/www/vhosts/mydomain.com/public_html/web/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #2 /var/www/vhosts/mydomain.com/public_html/web/wp/wp-includes/plugin.php(465): WP_Hook->do_action(Array) #3 /var/www/vhosts/mydomain.com/public_html/web/wp/wp-includes/post.php(3884): do_action('add_attachment', 6416) #4 /var/www/vhosts/mydomain.com/public_html/web/wp/wp-includes/post.php(5360): wp_insert_post(Array, false) #5 /var/www/vhosts/mydomain.com/public_html/web/app/plugins/qqworld-auto-save-images/qqworld-auto-save-images.php(2203): wp_insert_attachment(Array, '/var/www/vhosts...', 0) #6 /var/www/vhosts/REDACTED. in /var/www/vhosts/mydomain.com/public_html/web/app/plugins/wp-optimize/includes/class-updraft-smush-manager.php on line 153

    • This topic was modified 3 years, 2 months ago by Ipstenu (Mika Epstein). Reason: Removing privileged information
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Anderson

    (@davidanderson)

    Hi,

    What does your ‘external script’ look like? I’ve added some code to our development version to prevent the fatal error, but it’d be useful to see what’s being done so that we can better understand it.

    David

    Thread Starter Winston

    (@anarchoi)

    Just something like this

    $new_post = array(
            'post_title' => $title,
            'post_content' => $post_content,  
            'post_status' => 'publish',
            //'post_date' => date('Y-m-d H:i:s'),
            'post_author' => f$userID,
            'post_type' => 'post',
            'post_category' => $wp_category,
            'tags_input' => array()
    	);
        $post_id = wp_insert_post($new_post, true);
    • This reply was modified 3 years, 3 months ago by Winston.
    Plugin Support Harshad

    (@bornforphp)

    @anarchoi

    Sorry for the delay!

    I’ll share the snippet with @davidanderson and update you soon on this issue.

    Thank you for your time and patience.

    Regards,
    Harshad

    Thread Starter Winston

    (@anarchoi)

    We are facing another major bug. Your plugin is completely breaking wp_insert_attachment() function when the option “automatically optimize newly uploaded images” is activated.

    Please check the following thread for a detailed report:
    https://wordpress.org/support/topic/featured-image-not-working-when-posting-to-wp-with-a-cron-job-wget/#post-11532477

    After spending a lot of time debugging this issue, we came to the conclusion that it is due to wp-optimize plugin because the issue goes away when we disable it. We are forced to uninstall the plugin until the bugs are fixed.

    • This reply was modified 3 years, 3 months ago by Winston.
    Plugin Author David Anderson

    (@davidanderson)

    @anarchoi There’s no post at the link you’ve pasted. Please can you supply the further details here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error: Uncaught Error: Call to a member function add_logger() on boolean’ is closed to new replies.