- This topic has 5 replies, 3 voices, and was last updated 7 years ago by Andrew Misplon.
- AuthorPosts
- January 28, 2017 at 5:16 pm #5823
Simon Social MediaParticipantHi,
In Google Webmaster I’m seeing the following errors:
Missing: author
Missing: entry-title
Missing: updatedThis is summarised in this article but I can’t work out where I find single.php and if this is a common problem with the Ultra theme?
How to Fix Structured Data Errors Showing in Google Search Console (Webmaster Tools)
Any advice on how to resolve?
Thank you.
January 28, 2017 at 8:36 pm #5825
Andrew MisplonKeymasterHi Simon
The issue is WordPress using a class called hentry on pages and posts. Ideally, it needs to be removed from pages. Structured data is intended for syndicated content, meaning posts. Here is how I recommend fixing:
1.
Plugins > Add New
, install Code Snippets plugin, activate.
2.Snippets > Add New
, name as you’d like and insert the following in the snippet body:if ( ! function_exists( 'ultra_post_class_filter' ) ) : /** * Filter post classes. * @link https://codex.wordpress.org/Function_Reference/post_class. */ function polestar_post_class_filter( $classes ) { $classes[] = 'post'; // Resolves structured data issue in core. See https://core.trac.wordpress.org/ticket/28482. if ( is_page() ) { $class_key = array_search( 'hentry', $classes ); if ( $class_key !== false) { unset( $classes[ $class_key ] ); } } $classes = array_unique( $classes ); return $classes; } endif; add_filter( 'post_class', 'ultra_post_class_filter' );
There is a link in the function to read about this issue on wp.org if you want to.
Finally, select the option to only run the snippet on the site front-end and click Save changes and activate.
Also, make sure that all the meta settings are enabled at
Appearance > Customize > Theme Settings > Blog
. If you disable the author output for example, that info will be missing from single posts.January 29, 2017 at 2:36 pm #5830
Simon Social MediaParticipantHi Andrew – that seems to have done the trick, thank you very much!
January 29, 2017 at 7:24 pm #5832
Andrew MisplonKeymasterGreat 🙂 Really glad to hear that did the trick. All the best.
October 2, 2017 at 4:31 pm #7930
ReidParticipantHi Andrew,
I am having the same issue with console not recognizing the author, title and updated info. Rather than start a new thread, I did a search and found this one. I followed your instructions regarding adding the snippets plugin and received the following errors above each post on my blog page (https://www.aixploringprovence.com/blog-journal/):
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘ultra_post_class_filter’ not found or invalid function name in /home7/aixplori/public_html/wp-includes/class-wp-hook.php on line 300
Warning: array_unique() expects parameter 1 to be array, null given in /home7/aixplori/public_html/wp-includes/post-template.php on line 545
Warning: join(): Invalid arguments passed in /home7/aixplori/public_html/wp-includes/post-template.php on line 423
class=””>I’ve deactivated the plugin for now (to remove the ugly error messages from the page) until I hear back about what this means and if I may have done something incorrectly?
Thanks for any advice you may have.
October 2, 2017 at 4:39 pm #7931
Andrew MisplonKeymasterHi Reid
Thanks for reaching out 🙂
Please, can you post this as a new topic. We do our best to work a thread per user per issue. It’s great to jump if you can offer help on an open issue but if you have a fresh question, even if it’s related, we prefer to work a new topic. That way the initial poster doesn’t get notifications and there isn’t any confusion with differing setups for a similar issue.
You’re a premium user so you’re also welcome to reach out via email: [email protected].
- AuthorPosts
You must be logged in to reply to this topic.