Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    How was your cron is triggered ?

    Best regards,

    Thread Starter Kézily Correa

    (@kezily)

    Hi @qtwrk,

    The WP-Cron is triggered every 1 minute.

    * * * * * wget (...)/wp-cron.php

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try add this code into your theme’s functions.php

    
    function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) {
        if  ( 'publish' === $new_status && 'publish' !== $old_status )
         {
                error_log('hook test');
        }
    }
    add_action( 'transition_post_status', 'wpdocs_run_on_publish_only', 10, 3 );
    

    and see if your php error log file logs “hook test” string ?

    Best regards,

    Thread Starter Kézily Correa

    (@kezily)

    Hello,

    I added the code to my theme and tested. It works, but not with scheduled posts.

    Plugin Support qtwrk

    (@qtwrk)

    by WP doc , it states transition_post_status is a generic action that is called every time a post changes status

    I assume scheduled to published should also trigger this ?

    Thread Starter Kézily Correa

    (@kezily)

    The scheduled posts are being published, but not appear on homepage because of LiteSpeed Cache. I can’t purge cache every time I schedule a post.

    How can I fix this?

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    okay , then please try this

    in above code , change error_log('hook test'); to

    
    if (defined('LSCWP_V')) {
    do_action( 'litespeed_purge_post', $post->ID );
    }
    

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    I’m going to mark this topic “Resolved”, due to lack of activity.

    If you still need help, please feel free to re-open it.

    When re-open it, please also change the topic status to “not solved”

    Best regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem with scheduled posts’ is closed to new replies.