Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] Including Ajax files in WordPress so the code fires early enough to be used for the rest of the plugin.
<?php
require dirname( __FILE__ ) . '/inc/sensei-ajax.php';
/**
* All Ajax functionality. This is included in a single file
* so that the events can be registered earlier in the WordPress lifeycle.
*
* @since 1.0.0
*/
function sensei_start_ajax() {
$ajax = new Sensei_Ajax();
$ajax->init();
}
sensei_start_ajax();
<?php
require_once dirname( __FILE__ ) . '/lib/sensei-timed-quizzes/sensei-timed-quizzes.php';
/**
* Begins execution of the Timed Quiz plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function sensei_timed_quizzes_start() {
$plugin = new Sensei_Timed_Quizzes();
$plugin->run();
}
sensei_timed_quizzes_start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.