Forum Replies Created

Viewing 12 replies - 16 through 27 (of 27 total)
  • Thread Starter inktvusa

    (@inktv)

    @futtta – Oh darn, missed out on the party. 😛

    I decided to go your route with wp_schedule_event.

    functions.php

    add_action('wp', 'sched_wplytermcache_function');
    
    	function sched_wplytermcache_function() {
    		if (! wp_next_scheduled ( 'my_hourly_event' )) {
    		wp_schedule_event(time(), 'hourly', 'my_hourly_event');
    		}
    	}
    
    add_action('my_hourly_event', 'exec_wp_lyte_rm_cache');
    
    	function exec_wp_lyte_rm_cache() {
    		if ( function_exists( 'lyte_rm_cache' ) ) {
    		lyte_rm_cache();
    		}
    	}

    However, the function did not work. I even tried to call wp-cron manually:

    http://www.example.com/wp-cron.php?doing_wp_cron=1

    I then installed a plugin called “WP Control” and it showed that the even was not scheduled.

    Could you please code it how you think it should look? I cannot seem to grasp this. 🙁 I really love this plugin.

    Thank you.

    Thread Starter inktvusa

    (@inktv)

    @bdbrown – I apologize, I was not aware of the rules. My apologies!

    Thread Starter inktvusa

    (@inktv)

    Frank I am trying really hard to understand. Please excuse my ignorance. I tried the following code which is the proper way to load WP environment externally.

    <?php require( 'wp-load.php' );
    if ( function_exists( 'lyte_rm_cache' ) ) {
    lyte_rm_cache();
    }

    However, this is not working. This is the same code I use for another plugin called WP Rocket to clear the cache and it works.

    <?php require( 'wp-load.php' );
    if ( function_exists( 'rocket_clean_domain' ) ) {
    rocket_clean_domain();
    }

    The developer explained this here : http://docs.wp-rocket.me/article/494-how-to-clear-cache-via-cron-job

    Could you please help me to understand how to do something similar? I can pay you if you feel I am wasting your time.

    Thank you!

    Thread Starter inktvusa

    (@inktv)

    I created a separate PHP file called remcache.php and added this code into it:

    <?php 
    
    require_once('/home/xxx/public_html/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php' );
    
    	lyte_rm_cache(); 
    ?>

    I created a cron job on my server to execute that PHP file every hour.

    I do not get any errors at all… but the cached image does not update either.

    Any ideas?

    Thread Starter inktvusa

    (@inktv)

    Can you please tell me where I am going wrong?

    <?php 
    
    require_once('/home/xxx/public_html/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php' );
    
    	lyte_rm_cache(); 
    ?>

    Why is passing an anonymous function not clearing the cache since it’s already defined in options.php?

    /** function to flush YT responses from cache */
    function lyte_rm_cache() {
    	try {
    		$lyte_posts=json_decode(get_option('lyte_cache_index'),true);
    		if (is_array($lyte_posts)){
    			foreach ($lyte_posts as $postID => $lyte_post) {
    				foreach ($lyte_post as $cachekey) {
    					delete_post_meta($postID, $cachekey);
    				}
    			}
    			delete_option('lyte_cache_index');
    		}
    		return "OK";
    	} catch(Exception $e) {
    		return $e->getMessage();
    	}
    }

    Thank you.

    Thread Starter inktvusa

    (@inktv)

    Awesome, thanks! 🙂

    Thread Starter inktvusa

    (@inktv)

    Is there a way to schedule a cron job so that every 30 minutes I can clear lyte cache? If not, I will try your suggestion.

    Thank you again Frank. You’re the best.

    Thread Starter inktvusa

    (@inktv)

    Frank,

    In addition, I tried a key without a referrer restriction and it worked properly. It would still be great if you could update the plugin to include the referrer.

    Thank you for such a great plugin. 🙂

    Thread Starter inktvusa

    (@inktv)

    Hi Frank,

    All API keys that I have are working for every plugin that requires it. However, with this plugin, I am getting “Client errors (4xx)” in my API Dashboard. I tested my key using this URL :

    https://www.googleapis.com/youtube/v3/videos?part=snippet&id=<vid-id>&key=<my-key>

    This is the error I received in the JSON response :

    {
    “error”: {
    “errors”: [
    {
    “domain”: “usageLimits”,
    “reason”: “ipRefererBlocked”,
    “message”: “The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.”,
    “extendedHelp”: “https://console.developers.google.com/apis/credentials?project=462388451704&#8221;
    }
    ],
    “code”: 403,
    “message”: “The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.”
    }
    }

    Can you please update your plugin to specify the referrer which could be the IP or domain name, please?

    Thank you!

    Thread Starter inktvusa

    (@inktv)

    Hi Frank,

    All API keys that I have are working for every plugin that requires it. However, with this plugin, I am getting “Client errors (4xx)” in my API Dashboard. I tested my key using this URL :

    https://www.googleapis.com/youtube/v3/videos?part=snippet&id=<vid-id>&key=<my-key>

    This is the error I received in the JSON response :

    {
    “error”: {
    “errors”: [
    {
    “domain”: “usageLimits”,
    “reason”: “ipRefererBlocked”,
    “message”: “The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.”,
    “extendedHelp”: “https://console.developers.google.com/apis/credentials?project=462388451704&#8221;
    }
    ],
    “code”: 403,
    “message”: “The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.”
    }
    }

    Can you please update your plugin to specify the referrer which could be the IP or domain name, please?

    Thank you.

    Thread Starter inktvusa

    (@inktv)

    Hi,

    Great! That worked beautifully.

    Now, you should make the interface more user-friendly and charge for this plug-in. I could barely find any plugins like this on the market, we need them more than you think. 🙂

    Thanks!

    Thread Starter inktvusa

    (@inktv)

    @matt – I was using

    [product id="{{product_id}}"]

    I tried this instead and it worked:

    [product_page id="{{product_id}}"]

    Thanks for pointing me in the right direction 🙂

Viewing 12 replies - 16 through 27 (of 27 total)