the_answer_list + the_content filter + AJAX

hey there,

i am loading a single question via ajax

and there is a complete template loaded inside the answers body

i noticed that the_content gets filtered

core.php

add_filter( 'the_content', array( &$this, 'add_custom_content' ), 10, 1 );

function add_custom_content( $content ) {
global $post;

if ( get_post_type( $post ) == 'question' && ! is_single() ) {

$prepend_content = $this->get_template_details( QA_PLUGIN_DIR . '/default-templates/archive-question-single.php', array(), false, false );
$content = $content . $prepend_content;

//$content = print_pre($post).get_post_type( $post );
}

if ( is_singular( 'question' ) ) {

$append_content = $this->get_template_details( QA_PLUGIN_DIR . '/default-templates/single-answers.php' );
$content = $content . $append_content;
//$content = print_pre($post).get_post_type( $post );
}

return $content;
}

inside the template i can just use $post -> post_content

and its fine

but answers are displayed by the_answer_list()

inside template-tags.php

what would be an elegant solution to not alter core files and not filter the content when im loading with ajax. is there an intended option to load questions via ajax that im missing?

could i temporarily remove the filter

get my php file via ajax

and then reactivate the filter

do i have to target the method inside of the class instance

add_filter( 'the_content', array( &$this, 'add_custom_content' ), 10, 1 );

or can i just use

add_filter( ‘the_content’, ‘add_custom_content’ );

something like

add_action( ‘wp_ajax_nopriv_get_answers’, ‘get_answers’ );

add_action( ‘wp_ajax_get_answers’, ‘get_answers’ );

function get_answers(){

remove_filter( ‘the_content’, ‘add_custom_content’ );

get_template_part( ‘template-parts/question’:wink:;

add_filter( ‘the_content’, ‘add_custom_content’ );

}

`

thanks