Automated mark posts as featured every day

OK, so first of all you’ll need to add your own WP_Schedule event: add_action( ‘wp’, function () { if (! wp_next_scheduled ( ‘mark_posts_as_featured_event’ )) { wp_schedule_event(time(), ‘daily’, ‘mark_posts_as_featured_event’); } } ); function mark_posts_as_featured_event_callback() { // if there are sticky posts in our CPT, unstick them $sticked_post_ids = get_option( ‘sticky_posts’ ); if ( ! empty ) … Read more

execute function in wordpress plugin using crontab

I found a great solution here: Trigger a custom wordpress plugin with a linux cron My path was /usr/bin/wp so check your server. You can just add your function to a file, and using the wp bin script you don’t need to add anything to your php file to use WordPress functions. I was able … Read more

PHP5, Inheritance, Singleton – action & filter hook limitations

You don’t have to declare the constructor public, just the action hook function. Example: <?php /* Plugin Name: Singleton Action */ class Singleton_Demo { /** * @static $instance Objekt * @access private; */ private static $_instance = NULL; protected function __construct() {} private final function __clone() {} public static function getInstance() { if ( self::$_instance … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)