• Resolved ralfg

    (@ralfg)


    Hi! We are scheduling WordPress Posts with an embedded Youtube Lyte Video. At the time of scheduling, the Youtube Video is not public yet (scheduled too) – neither is the WP Post.

    If the author, however, opens the preview of the post (containing the link to the not yet published video) a grey thumbnail image is cached by Lyte. Once the video and post both go online, the cache still serves the grey thumbnail and not the actual thumbnail (by design, I guess).

    Hence, I’m wondering:

    (1) is there a way to only enable Lyte caching once a post is public / the Youtube video is public respectively?

    OR
    (2) reset the Lyte cache whenever the post goes public?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Morning Ralf;
    (1) no, but for (2) this might work (not tested);

    add_action( 'transition_post_status',  function( $new_status, $old_status, $post ) {
        if ( 'publish'?=== $new_status && function_exists( 'lyte_rm_cache' ) ) {
            lyte_rm_cache();
        }
    }, 10, 3 );

    hope this helps,
    frank

    Thread Starter ralfg

    (@ralfg)

    Many thanks, Frank!
    Not the best solution but it works. I refined your statement as follows to only reset the cache for posts of a specific category

    add_action( 'transition_post_status', function( $new_status, $old_status, $post ) {
    if ( 'publish' === $new_status && 'publish' != $old_status && has_category('your_category_name', $post->ID) && function_exists( 'lyte_rm_cache' ) ) {
    lyte_rm_cache();
    }
    }, 10, 3 );

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

    have a nice day!
    frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cache thumbnails locally – only on public sites / public YouTube videos’ is closed to new replies.