I have used the following code in functions.php to retrieve the title of my WordPress Theme which is being got ready for Themeforest release.
add_theme_support( 'title-tag' );
And then I have used the code below (functions.php) as a backwards compatibility for older versions:
if ( ! function_exists( '_wp_render_title_tag' ) ) {
function theme_slug_render_title() {
?>
<title><?php wp_title( '|', true, 'right' ); ?></title>
<?php
}
add_action( 'wp_head', 'theme_slug_render_title' );
}
Well, everything is OK for Theme Check Plugin as the plugin doesn’t indicate any warnings, requirements, recommendations, info etc.
But the themecheck.org which is an online service for theme check indicates a CRITICAL ALERT like this:
Title : Title The tags can only contain a call to wp_title(). Use the wp_title filter to modify the output.
I have figured it out that the second code snippet causes this ALERT. If I remove this code, then it is OK for themecheck.org.
As far as I know that wp_title() is a required function in Themeforest WordPress Theme.
And now, I would like to know
- What if I use the two codes simultaneously? Is there any chance to get rejection (hard/soft) in Themeforest?
- What if I remove the backwards compatibility code, the second code snippet?
Thanks a lot for reading.