Does SNAP not work for scheduled posts? Here is the solution

Last week i met such problem in the website of friend: NextScripts: Social Networks Auto-Poster (SNAP) could publish any post to social media when you publish wp post manually. But when you scheduled it and then WP Cron publihed it, SNAP failed each time.
I googled the problem and in my surprise saw that there was no any evident solution for that. Every responders told that it should work by default. But it didn’t. So, i investigated it myself and solved the problem.

The problem was in another plugin’s code.
Some plugins have piece of code which are inserted to code without WP hooks. And we the Cron calls WP, that’s un-hooked codes cause fatal error. WP publishing happends, but after that some un-hooked code cause fatal error and process stops. That’s why SNAP can’t event start publishing because of system’s fatal error.

So we should just detect such plugins and remove/disable them. That will solve the problem.

How to detect them.
It is easy.

  1. Go to your wp-config.php, change WP_DEBUG constant value from false to true.
  2. Add this two lines after wp_debug defined row.
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    
  3.  Schedule any post for 1-2 minutes later and wait schedule happening.
  4. Then go to your wp-content folder, you will see WP log file there. Open it.
  5. You should see some fatal error there. See which plugin causes that and remove that plugin.
    Screenshot from 2016-06-01 09:11:10
  6. Schedule any post again, SNAP will work now!

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.