endurain
11/23/2019 - 7:45 PM

WPtesting Function

Just a simple testing function I wrote. It will test if a function is firing two different ways.


//place in plugin
function myplugin_cron_function() {
   //how I verfied function executes correctly via the following two actions
   echo '<h3>Recent Posts!!!!</h3>';//input this html into /index.php template
   // see if fires via email notification
   wp_mail('zacharyjsanders@gmail.com','Cron Worked', date('r'));//send me an email every 30s, which it does

}

add_filter ( 'wpmu_filter_hook', 'myplugin_cron_function' );

//place in template 
<?php apply_filters( 'wpmu_filter_hook', 'test'); ?>