Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
in Q2A Core by
edited by

With a new update from Google, I noticed the difference in search results. But structural data seems to be lacking. There are some errors. 


http://schema.org/Answer (url) 


http://schema.org/QAPage (Mainetity) 

See the link below to see the results. 

https://search.google.com/structured-data/testing-tool/u/0/?hl=tr#url=https%3a%2f%2felectronics2electrical.com%2f2441%2fwhich-device-use-to-convert -dc-to-AC

Q2A version: 1.8.1
moved by
i have same situation
Thanks for the URL. (I hid your other question since they're asking the same thing.)
Checking into it now, but the description of "mainEntity" is not making any sense right now...
For everyone who wants to test their website, use: https://search.google.com/structured-data/testing-tool/
Has this problem been fixed in ver 1.8.2?
@w101 Yes it has been fixed in 1.8.2. Note that if you have an advanced custom theme you may need to make some additional changes (check the functions that your theme overrides).

5 Answers

+3 votes
selected by
Best answer

OK here's what you need to do to fix the error. In the file qa-include/pages/question.php on line 263, change this:

$qa_content['main_tags'] = ' itemscope itemtype="http://schema.org/Question"';

to this:

$qa_content['main_tags'] = ' itemprop="mainEntity" itemscope itemtype="http://schema.org/Question"';

To fix the warnings about the missing URLs, in qa-include/qa-theme-base.php on line 1962 change this:

$this->output('<a href="' . $post['what_url'] . '" class="' . $classes . '">' . $post['what'] . '</a>');

to this:

$this->output('<a itemprop="url" href="' . $post['what_url'] . '" class="' . $classes . '">' . $post['what'] . '</a>');

Not sure why Google suddenly decided to make this an error as it worked perfectly fine before. From my research it seems that the "mainEntity" should be optional.

Nonetheless, I'll add the above into the next version of Q2A (though the url fix needs to be more generic and respond to the microdata config option). Since Google has officially announced they're using the Q&A structured data it's possible we'll be getting more people checking their sites.

UPDATE: I've just pushed some changes to the bugfix branch on GitHub that should solve the problem.

UPDATE 2: for the missing name problem, change the following lines. In qa-theme-base.php in the body_content function change the qa-body-wrapper line to this:

$extratags = isset($this->content['main_tags']) ? $this->content['main_tags'] : '';
$this->output('<div class="qa-body-wrapper"' . $extratags . '>', '');

Then in the main() function remove the line starting $extratags = then change the next line to:

$this->output('<div class="qa-main' . $hidden . '">');

edited by
resimag.com/p1/cdae5bd908.png  (Donut theme two error)
resimag.com/p1/f12c116af0.png  (Snowflat one error)

@Scott get all kinds of errors
Scott please answer.  qa-include/pages/question.php  on line 263 I have this:
    $qa_content['wrapper_tags'] = ' itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"';
But there is not that "$qa_content['main_tags'] = ' itemscope itemtype="http://schema.org/Question"';" as you said.
Where is problem? Why couldn't I find the line that you wrote?
There is no line starting $extratags in main function in question-base.php. This is too bad, google can't index my website and anything doesn't help that you said.
Please, someone who have solved this problem helps me. Exactly error I get is "missing mainEntity.text field (optional)"
ago by
Sir, would you please explain the update 2.
I did not change it. May be for that reason I get warning in line 232. Please check it and give me solution
0 votes

OK take 2 on this :) I realised I hadn't pushed up the changes to the bugfix branch, so they are now live. All the default themes definitely work correctly now.

Themes that have overridden the main() or body_content() functions may require changes. I sent a pull request to Ami for the Donut theme as that appears to be popular. You can copy the changes you see there, or I've put the whole body_content function below. In the file qa-donut-layer.php in the theme, replace the entire function with this:

function body_content()
    $sub_navigation = @$this->content['navigation']['sub'];

    if ( $this->template === 'admin' ) {
        unset( $this->content['navigation']['sub'] );

    $navigation = &$this->content['navigation'];

    if ( isset( $navigation['cat'] ) ) {
        donut_remove_brackets( $navigation['cat'] );


    $this->output( '<div class="container">' );
    $this->output( '<div class="top-divider"></div>' );
    $this->output( '</div>' );


    $this->output( '<div class="container visible-xs">' );
    $this->output( '<div class="top-search-bar">' );
    $this->output( '</div>' );
    $this->output( '</div>' );

    $extratags = isset($this->content['wrapper_tags']) ? $this->content['wrapper_tags'] : '';
    $this->output( '<div class="qa-body-wrapper"' . $extratags . '>', '' );

    $this->output( '<main class="donut-masthead">' );

    $this->output( '<div class="container">' );
    $this->output( '</div>' );

    $this->output( '<div class="container">' );

    $extra_title_class = $this->donut_page_has_favorite() ? ' has-favorite' : '';

    $this->output( '<div class="page-title' . $extra_title_class . '">' );
    $this->output( '</div>' );

    $this->output( '</div>' );

    $this->output( '</main>' );

    $this->output( '<div class="container">', '' );

    $this->widgets( 'full', 'top' );
    $this->widgets( 'full', 'high' );

    if ( !empty( $sub_navigation ) ) {
        // create the left side bar
        $this->left_side_bar( $sub_navigation );


    if ( !$this->donut_do_hide_sidebar() ) {

    $this->widgets( 'full', 'low' );
    $this->widgets( 'full', 'bottom' );

    $this->output( '</div> <!-- END container -->' );
    $this->output( '</div> <!-- END body-wrapper -->' );

@scott question without answer is giving error not warning.please check
This problem has been solved. I would like to see your site
I looked at the question. There are some questions on your site that some do not have error.
1. If there is no question description
2. If there is no question or no answer
3. If the problem minus the vote can give an error
minus vote note giving any error.
0 votes

Two warnings occur in two cases

1. When there is a question without content
The "Text" event is recommended to populate the text field. Please enter a value if available.

2. If there is no answer to the question
"You must make one of acceptedAnswer or suggestedAnswer"
Require text input in questions. And add a response to all missed questions.

This question is waiting to be answered.

These are just warning. I'm dealing with them.
For both of these the code Q2A produces is correct. If your question doesn’t have any text what are you supposed to put in there? And if there are no answers yet, how can you have a suggestedAnswer?

It’s all correct as per the schema.org definition. I’ve reported the missing answer error as a bug to Google, I suggest you do the same (there is a send feedback button on the testing tool).
This problem seems to be with some themes, I tried cleanstrap and this error is not there just cleanstrap is outdated.
+1 vote

Hey. Help. How to fix the problem in the theme:  Donut theme.

 Donut theme 

Donut theme

Donut theme

Upgrade theme. No problem
Testing please https://www.odevbul.org/odev-sor/3206

qestions no vote
Mail adress send pm. You send mu theme three day later
mc_9@mail.ru.  THX)_
merhaba türkçe biliyorsun sanırım aynı hata bendede var lütfen bu konuda yardımcı olsan bir türlü bulamadım donut temasını kendi sitesinden dün indirdim. güncel deilmi ek sorun paketi filanmı var
Bug fix olanı indirmen lazım
+1 vote


question2answer 1.8.3
donot theme 2.0.2
latest version snow flat..

I'm filling in all the fields, but still gives this error