asked 8 years ago


1) I would like to input question/answer content into the database with its surrounding html.
So if someone styles their question/answer with, say, a text direction (i.e.:<p dir=”rtl”></p>), then when that question/answer is displayed, it should be displayed in the same <p> tag (so that it is displayed as the author intended).
How can I do this?
2) I would like to set the text fields for question/answer submission with default “dir” attributes. So that when a question submit form or answer submit for is loaded, the surrounding <p> element has a “dir” attribute (which I will set according to some logic via php).
How can I do this?

Thank you very much.

1 Answers
answered 8 years ago


Hi, Please add the code below to wp-content/themes/your-theme-folder/functions.php

add_filter( 'dwqa_prepare_question_content', 'dwqa_theme_add_dir_to_content', 9999 );
function dwqa_theme_add_dir_to_content( $content ) {
	return '<dir>' . $content . '</dir>';
Powered by DW Question & Answer Pro