I’m using the wp_crontrol plugin to call an action added in my functions.php file which then calls a function in my plugin file. WP gets to my function but can’t call the class, I get this error: PHP Fatal error: Class 'RSS_Import' not found in xxx
I’m fairly certain that i am calling the class improperly, but I am not sure how to call the class BEFORE the wp_cron calls it.
functions.php
add_action( 'my_hookname', 'my_function_plugin' );
plugin_file.php
functions.php 'add_action( 'my_hookname', 'my_function_plugin' );’
plugin_file.php
if ( !defined('WP_LOAD_IMPORTERS') )
return;
// Load Importer API
require_once ABSPATH . 'wp-admin/includes/import.php';
if ( !class_exists( 'WP_Importer' ) ) {
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
if ( file_exists( $class_wp_importer ) )
require_once $class_wp_importer;
}
/**
* RSS Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* RSS Importer
*
* Will process a RSS feed for importing posts into WordPress. This is a very
* limited importer and should only be used as the last resort, when no other
* importer is available.
*
* @since unknown
*/
if ( class_exists( 'WP_Importer' ) ) {
class RSS_Import extends WP_Importer {
……….
function dispatch(){
error_log("In Dispatch", 0);
$this->header();
$this->get_posts();
$this->import_posts();
$this->footer();
}//dispath
function RSS_Import(){
}//rss_import
} //end class rss importer
error_log("im not called at all", 0);
$rss_import = new RSS_Import();
register_importer('rss', __('RSS', 'rss-importer'), __('Import posts from the Berkeley Blogs RSS feed.', 'rss-importer'), array($rss_import, 'dispatch'));
} // class_exists( 'WP_Importer' )
function my_function_plugin() {
$rss_import = new RSS_Import();
register_importer('rss', __('RSS', 'rss-importer'), __('Import posts from the Berkeley Blogs RSS feed.', 'rss-importer'), array($rss_import, 'dispatch'));
}