Here is a simple script that I use to test my WordPress scripts without needing to display the blog.
This example will load the WP engine, plugins, and display the current (virtual) cron jobs.
PHP Code:
<pre>
<?php
require_once( 'wp-load.php' );
//ini_set('display_errors',1); // Uncomment these 2 lines to get verbose error reporting
//error_reporting(E_ALL);
$crons = _get_cron_array();
print_r($crons);
In the above example I was checking to see if my auto-posts were scheduled to be pinged. When I discovered that they were not, I created this function:
PHP Code:
function my_ping($post_id) {
echo "Before ping.\n";
if (0 == (int) get_option('blog_public')) return;
generic_ping($post_id);
echo "Pinged!\n";
}
Bookmarks