Fix PHP warning in fast AJAX pipeline

This commit is contained in:
Tetrakern 2024-02-01 20:24:19 +01:00
parent e9dfaa44f5
commit e6d93afce4
2 changed files with 31 additions and 0 deletions

View File

@ -555,6 +555,30 @@ function fictioneer_add_content_warning_taxonomy() {
}
add_action( 'init', 'fictioneer_add_content_warning_taxonomy', 0 );
// =============================================================================
// MANUALLY REGISTER
// =============================================================================
/**
* Manually registers custom post types and taxonomies
*
* Note: This is mainly for the fast AJAX pipeline since
* the 'init' hook will not be called.
*
* @since 5.9.4
*/
function fictioneer_register_cpt_and_tax() {
fictioneer_fcn_story_post_type();
fictioneer_fcn_chapter_post_type();
fictioneer_fcn_collection_post_type();
fictioneer_fcn_recommendation_post_type();
fictioneer_add_genre_taxonomy();
fictioneer_add_fandom_taxonomy();
fictioneer_add_character_taxonomy();
fictioneer_add_content_warning_taxonomy();
}
// =============================================================================
// MODIFY DEFAULT CATEGORIES AND POST TAGS
// =============================================================================

View File

@ -61,6 +61,7 @@ function fictioneer_do_fast_ajax() {
require_once __DIR__ . '/_utility.php';
require_once __DIR__ . '/_query_helpers.php';
require_once __DIR__ . '/_caching_and_transients.php';
require_once __DIR__ . '/_cpt_and_taxonomies.php';
if ( get_option( 'fictioneer_enable_follows' ) && strpos( $action, '_follow' ) !== false ) {
require_once __DIR__ . '/_content_helpers.php';
@ -102,6 +103,9 @@ function fictioneer_do_fast_ajax() {
require_once __DIR__ . '/users/_avatars.php';
}
// Register custom post types and taxonomies
fictioneer_register_cpt_and_tax();
// Skip cache checks
if ( ! function_exists( 'fictioneer_caching_active' ) ) {
function fictioneer_caching_active( $context = null ) { return false; };
@ -198,6 +202,9 @@ function fictioneer_do_fast_comment_ajax() {
require_once __DIR__ . '/users/_avatars.php'; // Obviously
require_once __DIR__ . '/comments/_comments_form.php'; // Obviously
require_once __DIR__ . '/comments/_comments_threads.php'; // Obviously
// Register custom post types and taxonomies
fictioneer_register_cpt_and_tax();
}
// Function exists?