@olimate,
Thanks for reaching out!
You can set a global title for all your posts here under the Search Appearance > Custom Post Types tab.
More information about that can be found here: https://aioseo.com/docs/setting-the-seo-title-and-description-format-for-custom-post-types/
You mentioned that the titles changed after the update to version 4. What exactly are you seeing in the area above as well as in your posts themselves?
We have had a few reports of some themes that are not fully working with AIOSEO so I’m curious if this might be a theme conflict.
What theme are you currently using?
Hi, thanks for your reply.
I’m using a custom template where the single posts display as a title, the post title + the custom post title (a relationship ACF Advanced Custom Field).
So, in the AIOSEO setup, the field for title posts was blank because I used in my header.php this:
<?php if (is_single() ) : ?><title><?php the_title(); ?> • <?php $post_object = get_field('author'); if( $post_object ): $post = $post_object; setup_postdata( $post ); ?><?php the_title(); ?><?php wp_reset_postdata(); ?><?php endif; ?></title><?php else : ?><title><?php wp_title(''); ?></title><?php endif; ?>
And it was worked fine, since the last update to version 4 (so I downgrade to 3 again).
Any idea how to solve it?
@olimate,
Thanks for letting us know about how you are using titles. That is really helpful.
In our next release, we will have a filter where you can disable the title rewriting that we are doing and it should address this issue. The filter will be:
aioseo_disable_title_rewrites
Just make sure that returns true and our code will no longer run to rewrite the title.
I’ll let you know when the release has gone out with this filter.
We’ve just pushed out an update that should fix this issue. Can you update to 4.0.9 and see if that resolves it? You’ll need to use the filter mentioned above and it should return true to disable our rewrites.
Thanks for your support Benjamin!
I think it works now. I just updated the plugin and add this function to my functions.php file:
add_filter( 'aioseo_disable_title_rewrites', 'change_wordpress_seo_title' );
function change_wordpress_seo_title(){
return true;
}
So now, all the AIOSEO titles defined in the plugin are not displayed. But, do you know how can apply it only in single.php posts?
Thanks in advance!
-
This reply was modified 4 years, 10 months ago by
olimate.
Hey @olimate,
Try this –
add_filter( 'aioseo_disable_title_rewrites', 'change_wordpress_seo_title' );
function change_wordpress_seo_title(){
if ( is_singular() ) {
return true;
}
return false;
}
– Arnaud
Hi Arnaud,
Thanks for your reply but still doesn’t works. My single.php still adding the AIOSEO title:
<!-- All in One SEO 4.0.9 -->
<title>TEST</title>
Rather than the one is defined in my header.php
<?php if (is_single() ) : ?><title><?php the_title(); ?> • <?php $post_object = get_field('author'); if( $post_object ): $post = $post_object; setup_postdata( $post ); ?><?php the_title(); ?><?php wp_reset_postdata(); ?><?php endif; ?></title><?php else : ?><title><?php wp_title(''); ?></title><?php endif; ?>
Anyway, Merry Xmas!
Oh sorry, I forgot that we have an issue open to move the hook elsewhere because it currently runs somewhere where the query/context info isn’t available yet. That’s why that code snippet is failing. We should fix this soon in one of the next updates.
Merry Christmas to you too!
I can confirm that now it works without the need to add extra code in functions.php. I really appreciate this, thanks!
Awesome, glad to hear it. Thank you for following up on that and providing us with some feedback!